SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.setFocusedIndex  method

将具有输入焦点的单元格的位置,变更为通过参数index而指定的单元格。 

如果index无效值,就需要首先进行标准化后,再进行变更。 如果focus参数为true,当具有新焦点的单元格没有被显示在当前网格时,将会滚动而进行显示。 

可以通过focusedIndex属性,了解目前具有焦点的单元格的位置。 

function setFocusedIndex (value: CellIndex, focus: Boolean, select: Boolean): this;
Returns
this
Parameters
value - CellIndex. required.
focus - Boolean. 默认值为false.
select - Boolean. 默认值为true.
Code -1
    // 上移一行。
    $('#moveUp').click(function () {
        var index = grid.focusedIndex();
        index.rowIndex--;
        grid.setFocusedIndex(index, true);
    });
    // 下移一行。
    $('#moveDown').click(function () {
        var index = grid.focusedIndex();
        index.rowIndex++;
        grid.setFocusedIndex(index, true);
    });
See Also
focusedIndex
setFocusedRow
setFocusedCell
CellIndex.normalize
GridBase.isValidCell
Examples
聚焦单元格