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.

assign( ) method (JSDO class)<br />

assign( ) method (JSDO class)<br />

Updates field values for the specified temp-table record referenced in JSDO local<br />

storage. The specified record can be either the working record of a referenced<br />

temp-table or any record provided by a JSRecord object.<br />

After execution, any working records previously set before the method executed<br />

remain as the working records. To synchronize the change on the AppServer, call the<br />

saveChanges( ) method.<br />

Return type: Boolean<br />

Applies to: JSRecord object, progress.data.JSDO class, table reference property<br />

(JSDO)<br />

Syntax<br />

[table-ref.]assign ( update-object )<br />

jsrecord-ref.assign ( [ update-object ] )<br />

table-ref<br />

A table reference on the JSDO for a temp-table that has a working record. If the<br />

JSDO references only a single temp-table, the method can be called on the JSDO<br />

itself.<br />

jsrecord-ref<br />

A reference to a JSRecord object for a temp-table record in JSDO local storage.<br />

update-object<br />

Passes in the data to update the specified record object in JSDO local storage.<br />

Each property of the object has the name of a temp-table field name and the value<br />

to set for that field in the specified record. Any temp-table fields without<br />

corresponding properties in update-object remain unchanged in the record.<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(update-object);<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 uses the findById( ) method to find the original record<br />

with the matching internal record ID (jsrecord) and invokes the assign( ) method on<br />

jsrecord with an object parameter to update the fields in eCustomer with any new<br />

values entered into the form.<br />

See also: getSchema( ) method, saveChanges( ) method<br />

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

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

Saved successfully!

Ooh no, something went wrong!