SMART datagrid v.1 > Classes > GridDataSet

Back  Forward

DataLudi.GridDataSet.updateRow  method

Change the values of data row which is specified by row as values

values can be JSON object or array of which field names are property. 

If checkDiff is true, it will update the row only when one or more field values are different by comparing the value of values with the existing field value. If strictDiff is true, it will compare with DataField.equalValues, sameValues

If checkEmpty is true, the field value of undefined among values will not be reflected. 

Only if one or more field values are actually reflected, State will be changed as UPDATED and will return true. If not, it will return false

onRowUpdating event will be fired before the update and onRowUpdated event will be fired after the update. 

function updateRow (row: Integer, values: *, checkDiff: Boolean, strictDiff: Boolean, checkEmpty: Boolean);
Returns
Void
Parameters
row - Integer. required.
values - *. required.
checkDiff - Boolean. Defaults to false.
strictDiff - Boolean. Defaults to false.
checkEmpty - Boolean. Defaults to false.
Note
Code -1
    ds.onRowUpdated = function (ds, row) {
        var values = ds.getRowObject(row);
        $('#addr').val(values.addr),
        $('#salary').val(values.salary),
        $('#name').val(values.name)
    };
    
    $('btnUpdate').click(function (ev) {
        var row = grid.focusedDataRow();
        if (row) {
            ds.updateRow(row.dataIndex(), {
                addr: $('#addr').val(),
                salary: $('#salary').val(),
                name: $('#name').val()
            }, true);
        }
    });
See Also
onRowUpdating
onRowUpdated
setValue
updateRows
Examples
Row Updating