tmt.spry.Dataset

tmt.spry.Dataset is JavaScript library that extends Spry's Spry.Data.DataSet by adding methods to perform various insert/update/delete operations

In order to use this library you need tmt_spry_dataset.js and SpryData.js from Spry

Samples

API

API are the same as Spry.Data.DataSet plus the additional methods listed below
DataSet constructor tmt.spry.Dataset is the constructor function for the Data Set. The constructor takes an optional single argument, which is an object that specifies the initial options for the Data Set (see Spry docs for details).
var ds = new tmt.spry.Dataset();
ds.clearRows() Removes all the records from the dataset and notify observers
ds.deleteRows(criteria) Delete rows matching given criteria. First argument must be an object, containing name value pairs. Notifies observers only if some data gets deleted
ds.getRowCloneByNumber(number) Spry's native getRowByRowNumber() returns a *reference* to its internal data structure. If you change the value you get back, the dataset is updated without notifying observers, or maintaining any related internal structures. This method instead, returns a by-value copy of a row
ds.insertRows(rowObj) Adds rows to a dataset. Accept either one single object or an array of objects (multiple insert)
ds.replaceAllRows(rowObj) Given a row, or an array of rows, remove the current content from the dataset and populate it from scratch
ds.selectRows(criteria) Select rows matching given criteria. First argument must be an object, containing name value pairs. Returns an array containing by-value copies of row/s
ds.updateRows(criteria, rowObj) Update rows matching given criteria. First argumentmust be an object, containing name value pairs. Notifies observers only if some data gets modified