Home  >  Article  >  Java  >  Analysis of extjs gridpanel's technical explanation of obtaining selected rows from operation rows

Analysis of extjs gridpanel's technical explanation of obtaining selected rows from operation rows

巴扎黑
巴扎黑Original
2017-07-24 14:46:441822browse

extjs gridpanel operates the row to get the column of the selected row

在Extjs 3.2.0上适合
var model = grid.getSelectionModel();  
model.selectAll();//选中所有行  
model.selectFirstRow();//选中第一行  
model.selectLastRow([flag]);//选中最后一行,flag为正的话保持当前已经选中的行数,不填则默认false  
model.selectNext();//选中下一行  
model.selectPrevious();//选中上一行  
model.selectRange(startRow,endRow, [Boolean keepExisting] );//选中范围间的行  
model.selectRow(row);//选中某一行,,,从0开始  
model.selectRows(rows);//选中指定一些行,传递数组如[1,3,5],则分别选择1,3,5行  
model.clearSelections();//清空所有选中  
model.deselectRange( startRow, endRow );//取消从startrow到endrow的记录的选择中态  
model.deselectRow(row);//取消指定行的记录grid.getSelected().id //得到选中的行的标识
<br>
得到选中的行。
书上的P62页:
 var sm=grid.getSelectionModel();
var record=sm.getSelections()[0];这个代表选择的一行,书上少了一个s。
var record=sm.getSelections()表示选中的很多行,得到的是一个数组。
精确到具体某一列的数据,, record.get("列名")。
适合Extjs 3.2
var sm=grid.getSelectionModel();
var record=sm.getSelected();
record只是一行数据。如果选择多好数据则这个不行了。

EditorGridPanel in Extjs gets the relevant information of the control in a certain cell

1. Get the control in the cell with column number colIndex and row number rowIndex The method is:
var compo= grid.getColumnModel().getCellEditor(colIndex, rowIndex);
2. Method to get the value of the control in the cell is:
var value = compo.getValue();
3. Assuming that compo is a combobox control, the method to obtain the data source of the control is:
var compoStore = compo.field .getStore();
4. Method to get the Index of the selected combobox based on 3:
var index = compoStore .find('column name', value) ;

The above is the detailed content of Analysis of extjs gridpanel's technical explanation of obtaining selected rows from operation rows. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn