Interface: DataGrid

DataGrid

Extends

Methods

addRecord(item, opts)

Adds the specified record to the DataGrid.
Parameters:
Name Type Description
item Record The record to add.
opts Object Optional options object with callbacks for when the operation is done.
Properties
Name Type Description
onSuccess function Callback function if the operation was successful.
onError function Callback function if the operation resulted in an error.

commit()

Saves changes made to the records held by the DataGrid.

deleteRecord(item, opts)

Deletes the specified record from the DataGrid
Parameters:
Name Type Description
item Record | ID The record to delete.
opts Object Optional options object with callbacks for when the operation is done.
Properties
Name Type Description
onSuccess function Callback function if the operation was successful.
onError function Callback function if the operation resulted in an error.

deselectAll()

Deselects all rows.

deselectRows(rowNumbers)

Deselects the specified rows.
Parameters:
Name Type Description
rowNumbers Array.<Number> The numbers of the rows to deselect (starting at row 0 at the top).

enableEdit(enable)

Enables or disables editing of the DataGrid's cells.
Parameters:
Name Type Description
enable Boolean Specifies whether to enable or disable editing.

get(name) → {Object}

Gets the value of the specified property.
Parameters:
Name Type Description
name String The name of the property.
Inherited From:
Returns:
- The property's value.
Type
Object

getActiveRecord() → {Record}

Returns the currently selected record.
Returns:
- The currently selected record.
Type
Record

getActiveRecordID() → {ID}

Returns the ID of the currently selected record.
Returns:
- The ID of the currently selected record.
Type
ID

getAllRecords(opts) → {Array.<Record>}

Returns all of the DataGrid's records.
Parameters:
Name Type Description
opts Object Optional options object configuring the operation.
Properties
Name Type Description
load Boolean If true, will attempt load records from the database in addition to the currently displayed records.
sort Boolean Enables sorting of records received from the database (note: requires opts.load to be true).
onSuccess function Callback function if the load operation was successful (note: requires opts.load to be true).
onError function Callback function if the load operation resulted in an error (note: requires opts.load to be true).
Returns:
- Array holding all of the DataGrid's records. If opts.load is enabled, this will return null and the records will be returned through the callback functions instead.
Type
Array.<Record>

getColumns() → {Array}

Returns the DataGrid's columns.
Returns:
- An array holding all of the DataGrid's columns
Type
Array

getId() → {ID}

Returns the ID of the widget.
Inherited From:
Returns:
- The ID of the widget
Type
ID

getQuery() → {Query}

Returns the query used to populate the DataGrid
Returns:
- The query used to populate the DataGrid
Type
Query

getRecord(id)

Returns the record with the specified id.
Parameters:
Name Type Description
id ID | String ID of the desired record.

getSelectedRecords(idsOnly) → {Array.<Record>|Array.<ID>}

Returns the currently selected records.
Parameters:
Name Type Description
idsOnly Boolean If true, only ID's will be returned.
Returns:
- An array holding the currently selected records, or an array holding the ID's of the currently selected records (if idsOnly was true).
Type
Array.<Record> | Array.<ID>

getValue() → {Object}

Returns the widget's value.
Inherited From:
Returns:
- The widget's value.
Type
Object

hide()

Hides the widget.
Inherited From:

isEnabled() → {Boolean}

Returns true if the widget is enabled.
Inherited From:
Returns:
- True if enabled, otherwise false.
Type
Boolean

isRowSelected(rowId) → {Boolean}

Checks if a row is currently selected.
Parameters:
Name Type Description
rowId String The id of the row to check.
Returns:
- True if the row is selected, false otherwise.
Type
Boolean

newRecord(item)

Creates a new record using the specified data.
Parameters:
Name Type Description
item Object Data to use for the new record.

refresh()

Refreshes the DataGrid

rollback()

Reverts changes made to the records held by the DataGrid.

selectAll()

Deselects all rows.

selectRows(rowNumbers)

Selects the specified rows.
Parameters:
Name Type Description
rowNumbers Array.<Number> The numbers of the rows to select (starting at row 0 at the top).

set(name, value)

Sets the value of the specified property.
Parameters:
Name Type Description
name String The name of the property.
value Object The new value.
Inherited From:

setEnabled(Enabled)

Enables/disables the widget.
Parameters:
Name Type Description
Enabled Boolean True to enable the widget, false to disable.
Inherited From:

setLabel(Label)

Sets the label on the button.
Parameters:
Name Type Description
Label String Text or HTML to set as the label on this button.
Overrides:

setQuery(query)

Sets the query used for fetching records into this grid
Parameters:
Name Type Description
query Query The query to use

setRecords(records)

Sets the records displayed by the DataGrid to the specified array of records.
Parameters:
Name Type Description
records Array.<Record> The records to display.

setRowData(rowId, data)

Sets the data of the specified row.
Parameters:
Name Type Description
rowId String The id of the row to change.
data Object The new data.

setStyle(Object)

Set the widget-style
Parameters:
Name Type Description
Object Object with style-properties
Inherited From:

setValue()

Sets the widget's value.
Parameters:
Type Description
Object The new value.
Overrides:

show()

Shows the widget.
Overrides: