SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.setSelection  method

Select the area between index1 and index2 in the form of style

If do not specify style, it will follow DisplayOptions.selectStyle settings. If focus is true, you can newly set the location of focused cell according to index1 and style settings. If index1 is CellIndex object, it will unconditionally set the focus in that location, and if style is row selection, it will maintain the focused column, and if it is column selection, it will maintain the focused row. In the rest cases like single selection, it will set the focus to the cell which is closest to index1 value. 

function setSelection (index1: CellIndex|Integer|GridColumn, index2: CellIndex|Integer|GridColumn, style: SelectionStyle, focus: Boolean): SelectionItem;
Returns
SelectionItem
Parameters
index1 - CellIndex|Integer|GridColumn. required.
The starting location of selection area.
You can only specify the row location by Integer value or only specify the column location by GridColumn object. v 1.3.8
index2 - CellIndex|Integer|GridColumn. required.
The ending location of selection area.
You can only specify the row location by Integer value or only specify the column location by GridColumn object. v 1.3.8
style - SelectionStyle.
If do not specify, it will follow DisplayOptions.selectStyle.
focus - Boolean.
If it is true, it will change the focus location according to the newly added selection area. v 1.3.8
Code -1
    $('#select').click(funciton () {
        var idx1 = grdMain.focusedIndex();
        var idx2 = new DataLudi.CellIndex(grdMain.focusedRowIndex() + 10, idx1.column);
        grdMain.setSelection(idx1, idx2, DataLudi.SelectionStyle.BLOCK, true);
    }
Code -2
    $('#select').click(funciton () {
        grdMain.setSelection(3, 11, DataLudi.SelectionStyle.ROWS, true);
    }
See Also
CellIndex
SelectionStyle
DisplayOptions.selectStyle
Examples
Selection