rejectRowChanges( ) method
- Last Updated: January 17, 2024
- 4 minute read
- OpenEdge
- Version 12.8
- Documentation
Rejects changes to the data in JSDO memory for a specified record object.
This can be the working record of a table reference or the record specified by a
JSRecord object reference. If the method succeeds, it returns
true. Otherwise, it returns false.
autoApplyChanges property is set to false. In this case, you might invoke this method in the callback for the
corresponding JSDO event fired in response to an unsuccessful record-change operation on the
server resource that was invoked by executing the saveChanges( ) method. If the autoApplyChanges
property is true, the JSDO automatically accepts or rejects
changes to the record object based on the success of the corresponding resource operation on
the server.Return type:
boolean
Applies to: progress.data.JSRecord class, progress.data.JSDO class, table reference property (JSDO class)
Working record: The working record is set depending on the changes rejected.
Syntax
|
- jsrecord-ref
- A reference to a
JSRecordobject for a table reference 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.
- 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.
When you reject changes on a specified record object, this method makes the record reflect all pending changes to it in JSDO memory. As the specified changes are rejected, the method also empties any associated before-image data, clears any associated error message setting, and removes the associated pending change indications from JSDO memory.
rejectRowChanges( ), any error message settings that result from Data Object
resource operations invoked by the most recent execution of the fill( ) or saveChanges( ) method remain
available for return by the getErrors( ) method until the
next execution of either fill( ) or saveChanges( ). For more information, see the getErrors( ) method description.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.saveChanges( ) method, do not invoke this method if you want the affected client data to be
consistent with the corresponding data on the server.Example
The following code fragment shows a JSDO created so it does not automatically accept or reject changes to data in JSDO memory after a call
to the saveChanges( ) method. Instead, it subscribes a
single handler for each of the afterDelete, afterCreate, and afterUpdate,
events to determine if changes to any eCustomer table
record in JSDO memory should be accepted or rejected based on the success of the
corresponding resource operation on the server. To change the data for a record, a jQuery
event is also defined on a save button to update the corresponding eCustomer record in JSDO memory with the current field values entered in a
customer detail form (#custdetail):
|
When the button is clicked, the event handler uses the findById( ) method to find the original record with the matching
internal record ID (#id) and invokes the assign( ) method on jsrecord
with an empty parameter list to update its fields in eCustomer with any new values entered into the form. It then calls the saveChanges( ) method to invoke the resource Update operation to
apply these record changes to the server. You might define similar events and controls to
delete the eCustomer record or add a new eCustomer record.
After each resource operation for a changed eCustomer record completes, results of the operation are returned to the client
from the server, and the appropriate event fires. If the operation was not successful, the handler calls rejectRowChanges( ) to reject the record change associated with the event in
JSDO memory. An advantage of using an event to manually reject a record change is that you
can perform other actions associated with rejecting this particular change, such as
displaying an alert to the user that identifies the error that caused the rejection.
saveChanges( ), which invokes each resource record-change
operation, one record at a time, across the network. For a resource that supports
before-imaging (such as an OpenEdge ProDataSet), you can also have saveChanges( ) send all pending record change operations across the network in a
single Submit operation. For more information and an example, see the description of the
saveChanges( ) method.See also:
acceptRowChanges( ) method, autoApplyChanges property, autoSort property, caseSensitive property, saveChanges( ) method, rejectChanges( ) method