SMART datagrid v.1 > Examples

Back  Forward

Set DataRows  Example

Instead of importing the data from the server with using Ajax, you can organize the initial data set by calling GridDataSet.setRows, etc. If call setRows, all existing data will be deleted, and if do not specify the state of the newly added rows, it will become NONE rather than DataRowState.CREATED. In the example below, "Set Json Rows" explicitly specifies CREATED

Grid - 1
rows

Two-dimensional array and Json object array load the data rows through GridDataSet.setRows, and XML can load them through GridDataSet.setXmlRows method. You can specify the location of the start row through start parameter and the maximum number of rows to be loaded through count parameter separately. If do not specify count or it is smaller than 0, it will fill to the last row. 

Code -1
    var rows = [
        { field1: 'value_101', field2: 'value_20', field3: '5555', field4: 'value_30' },
        ...
    ];
    dsMain.setRows(rows, 1, 2); // Load 2 rows from the first row.

View Source JSP 

See Also
GridDataSet
GridDataSet.clearRows
GridDataSet.setRows
GridDataSet.setXmlRows
DataSet.onRowCountChanged
Examples
Load CSV Data
Load JSON Data
Load XML Data