SMART datagrid v.1 > Classes > GridDataSet

Back  Forward

DataLudi.GridDataSet.setRowCount  method

Change the number of data rows. 

If count parameter is less than the existing row number, the rows after count will be deleted. Deleting event will not be fired. If count is greater than the existing row number, the data rows as much as needed will be added. 

If actually change the row number, onRefresh, onRowCountChanged events will be fired in order. 

If do not specify fillDefaults and defaultValues, the appended row will exist as an empty state without value, and it can be filled in with values by updateRow later. You can check whether the data row is empty by calling hasData

function setRowCount (count: Number, fillDefaults: Boolean, defaultValues: [*], rowState: String);
Returns
Void
Parameters
count - Number. required.
fillDefaults - Boolean. Defaults to false.
If it is true, when defaultValue of data field is not undefined, it will be initialized as this value.
defaultValues - [*]. Defaults to null.
When not initialized as properties of data field, if the field value corresponding to defaultValues is not undefined, it will be initialized as this value.
rowState - String. Defaults to ""none"".
If checkStates of data set is true, it will initialize the state of each data row by rowState.
Code -1
    $("$addRows").click(function () {
        var defaults = ['seoul', undefined, 7878, 'ludi'];
        ds.setRowCount(ds.rowCount() + 2, true, defaults);
    });
See Also
hasData
DataField.defaultValue
DataSet.rowCount
DataSet.checkStates
DataSet.onRefresh
DataSet.onRowCountChanged
Examples
Set Row Count