SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.onCurrentRowChanged  event

当聚焦的位置发生变更时,将会触发这个事件。 

当行的位置没有发生变更,而只变更聚焦列的位置时,只会触发onCurrentChanged。 而且,在变更之前,将会触发onCurrentChanging事件。 

当过于频繁地触发事件被视为是一种问题时,如果指定DisplayOptionsrowChangeDelay值, 即使数据行的位置发生变更,也不会在相应期间内触发这个事件。 

当网格中的数据行的选择发生变更时,可以被用于将数据行的详细信息显示在其他位置等的情况。 

function onCurrentRowChanged (grid: GridBase, newRow: Integer, oldRow: Integer);
Returns
Void
Parameters
grid - GridBase.
newRow - Integer.
oldRow - Integer.
Code -1
    grid.onCurrentRowChanged = function (grid, newRow, oldRow) {
        if (newRow >= 0) {
            $('#name').val(ds.getValue(newRow, 'fldName'));
            $('#salary').val(ds.getValue(newRow, 'fldSalary'));
        } else {
            $('#name').val('');
            $('#salary').val('');
        }
    };
See Also
onCurrentChanged
onCurrentChanging
focusedIndex
CellIndex
Examples
聚焦单元格