Row selection mode:
Js Code
Var rowcount = grid. getSelectionNode (). getSelections ();
You can obtain all selected records. The rowcount is an Array,
For example, to obtain the data of the sex column, the statement is as follows:
Js Code
Var strsex = rowcount. get ('sex ');
Var strsex = rowcount. get ('sex '); cell selection mode
If the following sm attribute is added to the Configuration Attribute of GridPanel
Js Code sm: new Ext. grid. CellSelectionModel ();
Sm: new Ext. grid. CellSelectionModel (); the table selection mode is cell selection mode. When you click, a corresponding cell is selected instead of a row by default. The selection method is as follows:
Js Code
Var cell = grid. getSelectionNode (). getSelectedCell ();
Var cell = grid. getSelectionNode (). getSelectedCell (); the cell records the selected row (cell [0]) and column (cell [1]). you can use the following statement to obtain the cell data.
Js Code
Var colname = grid. getColumnModel (). getDataIndex (cell [1]); // get the column name
Var celldata = grid. getStore (). getAt (cell [0]). get (colname); // get data
Var colname = grid. getColumnModel (). getDataIndex (cell [1]); // get the column name
Var celldata = grid. getStore (). getAt (cell [0]). get (colname); // get data
GetStore (): obtains the dataset of a table.
GetAt (): obtains the cell [0] row of the dataset.
Get (): get the data of colname for this row
Grid. getStore (). getCount gets the total number of record rows;
Grid. getStore (). selectRow (I) selected row