码迷,mamicode.com
首页 > Web开发 > 详细

extjs gridpanel 操作行 得到选中行

时间:2017-07-06 12:17:30      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:toolbar   padding   indent   指定   color   获取   middle   cin   tar   

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);
 
 
转自:http://blog.csdn.net/mastershaw/article/details/51385042

extjs gridpanel 操作行 得到选中行

标签:toolbar   padding   indent   指定   color   获取   middle   cin   tar   

原文地址:http://www.cnblogs.com/symbol8888/p/7125442.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!