SMART datagrid v.1 > Classes > DataField
Return true if the two values specified by parameter value1, value2 are the same.
It is compared less strictly than equalValues. Please refer to the table below.
Data type | The standard of determining the same value |
---|---|
TEXT | If one side is undefined, null, ''(empty string), the rest should also be one of them. Other cases will compare by equality operator(==). |
NUMBER | If one side is NaN, the reset should also be NaN. Other cases will compare by equality operator(==). |
BOOLEAN | Interpret and compare both values as Boolean. |
DATETIME | If one side is not Date object, the reset should not be Date object either. Other cases will compare by Date.getTime(). |
$('#setValue').click(function () {
var row = grid.focusedDataRow();
if (row >= 0) {
var f = ds.getFieldIndex('quantity');
var newVal = $('#quantity').val();
var orgVal = ds.getValue(r, f);
// Change only if the values are different.
if (!ds.getField(f).sameValues(newVal, orgVal)) {
ds.setValue(row, f, newVal);
}
}
});