分析extjs gridpanel从操作行得到选中行技术讲解

extjs gridpanel 操作行 得到选中行的列

在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 //得到选中的行的标识

得到选中的行。
书上的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只是一行数据。如果选择多好数据则这个不行了。

Extjs中EditorGridPanel获取某一单元格内的控件的相关信息

1. 获取列号为colIndex行号为rowIndex的单元格内的控件的方法为:

var compo= grid.getColumnModel().getCellEditor(colIndex, rowIndex);

2. 获取该单元格内的控件的值的方法为:

var value = compo.getValue();

3. 假设compo为combobox控件,则获取控件的数据源的方法为:

var compoStore = compo.field.getStore();

4. 在3的基础上获取选中的combobox的Index的方法:

var index = compoStore .find('列名',value);

以上就是分析extjs gridpanel从操作行得到选中行技术讲解的详细内容,更多请关注其它相关文章!

有勇气并不表示恐惧不存在,而是敢面对恐惧克服恐惧

分析extjs gridpanel从操作行得到选中行技术讲解

相关文章:

你感兴趣的文章:

标签云: