assign( ) method (JSDO class)
- Last Updated: May 9, 2017
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Updates field values for the specified JSRecord object in JSDO memory.
The specified record object can be either the working record of a JSDO table reference or
any record provided by a JSRecord object.
To synchronize the change on the server, call the saveChanges( ) method.
Alias:
update( )
Return type:
boolean
Applies to: progress.data.JSRecord class, progress.data.JSDO class, table reference property (JSDO class)
Syntax
|
- jsrecord-ref
- A reference to a
JSRecordobject for a table record in JSDO memory.You can obtain a
JSRecordobject by:- Invoking a JSDO method that returns record objects from a JSDO
table reference (
find( ),findById( ), orforeach( )) - Accessing the
recordproperty on a JSDO table reference that already has a working record. - Accessing the record parameter
passed to the callback of a JSDO
afterCreate,afterDelete, orafterDeleteevent. - Accessing each record object provided by the
jsrecordsproperty on the request object parameter passed to the callback of a JSDOafterSaveChangesevent, or passed to the callback of any Promise object returned from thesaveChanges( )method. Thejsrecordsproperty is only available on completion of a Submit operation (saveChanges(true)) on a resource that supports before-imaging, and not if the resource supports before-imaging without Submit.
- Invoking a JSDO method that returns record objects from a JSDO
table reference (
- jsdo-ref
- A reference to the JSDO. You can call the method on jsdo-ref if the JSDO has only a single table reference, and that table reference has a working record.
- table-ref
- A table reference on the JSDO that has a working record.
- update-object
- Passes in the data to update the specified record object in JSDO memory. Each property of the object has the name of a table field and the value to set for that field in the specified record. Any table fields without corresponding properties in update-object remain unchanged in the record.
autoSort
property, all the record objects for the affected table reference are sorted accordingly. If
the sorting is done using sort fields, any string fields
are compared according to the value of the caseSensitive
property.Example
The following code fragment shows a jQuery event defined on a save button to save the
current field values for a customer detail form to the corresponding
eCustomer record in JSDO memory:
|
The form has been displayed with previous values of the same record. When the button is
clicked, the event handler uses the findById( ) method to find the original
record with the matching internal record ID (jsrecord) and invokes the
assign( ) method on jsrecord with an object parameter to
update the fields in eCustomer with any new values entered into the
form.
See also:
autoSort property, caseSensitive property, getSchema( ) method, saveChanges( ) method