DataTable¶
Represents a table that contains data.
Capabilities¶
Row Management¶
- DataTable.Add: Appends a new row to the table and returns the new row.
- DataTable.CreateNew: Adds a row, optionally maps initial values, then invokes a callback with the new row as
this. - DataTable.DeleteAll: Marks all records in the data table as deleted.
- DataTable.Ensure: Ensures a row, or every row in an input array, is active and applies the supplied values.
Iteration and Access¶
- DataTable.Each: Executes the given callback function for every row in the data table.
- DataTable.Execute: Runs a callback with the table as
thisand returns the same table. - DataTable.Map: Converts all rows in the table to the return value of the given callback function.
- DataTable.RowCount: Returns the number of rows in the data table.
- DataTable.Rows: Returns all rows in the data table as a JavaScript array.
Conversion and Persistence¶
- DataTable.ExportToXml: Maps the table rows into XML using the supplied query mapping options.
- DataTable.ImportFromXml: Imports XML data into the specified table. If a record already exists in the table, it is updated. If no record exists, a new record is added to the table. Comparison is automatically done using the table's primary key.
- DataTable.ToDictionary: Returns a DataTableDictionary indexed by the specified columns for fast access.
Mutation and Persistence¶
- DataTable.Save: Saves changes made to the data table to the database.
Conversion¶
- DataTable.toJSON: Returns the current row as a plain object.