SMART datagrid v.1 > Classes > DataSet

Back  Forward

DataLudi.DataSet.setRowState  method

Set the state of data row which is specified by parameter row as state

If checkStates is true, you can set by this method by force though State of data row is automatically set during row appending, updating, deleting. If force is true, it will be set even if checkStates is false

It the state is changed actually, GridDataSet.onStateChanged event or TreeDataSet.onStateChanged event will be fired. 

function setRowState (row: Integer, state: DataRowState, force: Boolean);
Returns
Void
Parameters
row - Integer. required.
state - DataRowState. required.
force - Boolean. required.
If it is true, it will set the state unconditionally regardless of checkStates property.
Code -1
    $('#setUpdated').click(function () {
        var row = grid.focusedRow();
        row && ds.setRowState(row.dataIndex(), DataLudi.DataRowState.UPDATED);
    });
Code -2
    var createdRows = ds.getStateRows(DataLudi.DataRowState.CREATED);
    for (var i = 0; i < createdRows.length; i++) {
        if (ds.hasData(createdRows[i]) {
            ds.setRowState(createdRows[i], DataLudi.DataRowState.UPDATED, true);
        }
    }
See Also
onStateChanged
onStateChanged
setRowStates
getRowStateCount
getStateRows
getAllStateRows
DataRowState
Examples
Data Row States
Restore Updated Rows