JSDO properties, methods, and events reference : remove( ) method
  

remove( ) method

Deletes the specified table record referenced in JSDO memory.
The specified record can either be the working record of a referenced table or any record provided by a JSRecord object.
To synchronize the change on the server, call the saveChanges( ) method.
Return type: boolean
Applies to: progress.data.JSRecord class, progress.data.JSDO class, table reference property (JSDO class)
Working record: After execution, any prior working record setting for the affected table, and for any of its child tables, is no longer set.

Syntax

jsrecord-ref.remove ( )
jsdo-ref.remove ( )
jsdo-ref.table-ref.remove ( )
jsrecord-ref
A reference to a JSRecord object for a table record in JSDO memory.
You can obtain a JSRecord object by:
*Invoking a JSDO method that returns record objects from a JSDO table reference (find( ), findById( ), or foreach( ))
*Accessing the record property on a JSDO table reference that already has a working record.
*Accessing the record parameter passed to the callback of a JSDO afterCreate, afterDelete, or afterDelete event.
*Accessing each record object provided by the jsrecords property on the request object parameter passed to the callback of a JSDO afterSaveChanges event, or passed to the callback of any Promise object returned from the saveChanges( ) method. The jsrecords property 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.
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.
Note: This method does not trigger an automatic sort and has no effect on any existing sort order established for the table reference. However, if there is a sort order that depends on the presence or absence of the record object you are removing, and you want to establish a new sort order with this record object absent, you must manually sort the remaining record objects using the sort( ) method by passing it the same sort function that you used to establish the previous sort order.

Example

The following code fragment shows a jQuery event defined on a delete button to delete the record displayed in a customer detail form from the eCustomer table referenced in JSDO memory:
dataSet = new progress.data.JSDO( 'dsCustomerOrder' );

$('#btnDelete').bind('click', function(event) {
  var jsrecord = dataSet.eCustomer.findById($('#custdetail #id').val());
  if (jsrecord) {jsrecord.remove();};
  dataSet.saveChanges();
});
The form has been previously displayed with values from 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 remove( ) method on jsrecord to delete the record from eCustomer.

See also:

data property, saveChanges( ) method, sort( ) method