01.06.2013 Views

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

findById( ) method<br />

The following code fragment shows a jQuery event defined on a save button to save<br />

the current field values for a customer detail form to the corresponding eCustomer<br />

record in JSDO local storage:<br />

dataSet = new progress.data.JSDO( 'dsCustomerOrder' );<br />

$('#btnSave').bind('click', function(event) {<br />

var jsrecord = dataSet.eCustomer.findById($('#custdetail #id').val());<br />

jsrecord.assign();<br />

dataSet.saveChanges();<br />

});<br />

The form has been displayed with previous values of the same record. When the button<br />

is clicked, the event handler finds the original eCustomer record by calling<br />

findById( ) with the id attribute of the form ($('#custdetail #id').val()), which<br />

is set to the internal ID of the record. The jsrecord.assign( ) method then updates<br />

the record from the values of the corresponding form fields and saveChanges( )<br />

invokes the resource "update" operation on the AppServer to save the updated record<br />

to its data source.<br />

See also: data property, foreach( ) method, getId( ) method<br />

<strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong> 213

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!