![]() |
|
|
|
dynapi.util.DataSource - Quick Reference |
Inherit: EventObject, Requirements: IOElement, IOElementSoda |
|
url – URL of the Data Source; method – Method used to send data to Data Source. POST is the default ioelement - IOElement object used for send data to Data Source.
All arguments are optional. If no ioelement object was specified the IOElement.getSharedIO() object is used.
onalert(e) - Triggers whenever a warning or error has been generated.
onrecordchange(e) - Triggers whenever the record position changes. Do NOT call functions (such as moveFirst, moveNext, etc) that will change the record position of the database while you're inside this event.
onresponse(e,s) - Triggers after a server response.e - (EventObject) s - (Boolean) True is request was successfulonrequest(e) - Triggers after a request has been sent to the server.
e - (EventObject)
example:
var ds = new DataSource(); ds.setSource('dynapi.util.datasource-paging.asp','GET'); ds.connect(OnDSConnect,true,false); ds.addEventListener({ onrequest: function(e){ infoLyr.setHTML('Loading records...'); }, onresponse: function(e){ infoLyr.setHTML(' '); } });
onsubmit(e,s) - Triggered after data has been sent to the server. The s argument will be true is submitted data was successfully store.
onvalidate(e,data) - Triggered before data is sent to the server. The "data" argument contain field names and values to be submitted. See the DataSource Forms example for more information
addRecord()
cancelAction(norefresh) - Cancels the specified request.
connect (fn,useWebService,useSync,uid,pwd)
deleteRecord()
getField()
getAbsolutePage()
getRecordPosition()
getPageCount()
getPageSize()
getPageStart()
getPageEnd()
getRecordCount()
getRecord()
isEditMode()
moveFirst()
moveLast()
moveNext()
movePrev()
refresh(fld)
setAbsolutePage(n)
setField(fld,value)
setPageSize(n)
setRecord(data)
setRecordPosition(n)
setSource(url,method,ioelement)
submit()
DataSource.createBoundObject(o,getfn,setfn) - Creates or converts an object into data bound object.
o - Object to be converted getfn - Function to be called when data is requested frm the object setfn - Function to be called when data is to be written to the object
The setfn and getfn arguments are optional when creating a bound object for images or form elements such as input (i.e. text, textarea, etc), select, radio, checkbox, image
example:
// convert an image into a data bound image object var img=document.images['imgIcon']; img=DataSource.createBoundObject(img); img.setDataSource(ds,'icon');
DataSource.boundFormElements(frm,ds) - This will convert form elements into data bound objects and assign the specified data source.
frm - Form object ds - DataSource to be assigned to form elements
example:
DataSource.boundFormElements(document.forms["myform"],ds);