extjs - 如何在 Ext.grid.EditorGridPanel 中制作 selectRow
问题描述
处理使用 ExtJs 3.1.1 编写的项目:
我想在Ext.grid.EditorGridPanel
by中选择整行,selectRow()
但没有这种方法。
如果我将网格类型更改为Ext.grid.GridPanel
一切都会好的。
为什么 的行为Ext.grid.EditorGridPanel
不同于Ext.grid.GridPanel
?如何选择整行?
我的网格如下:
var grid = new Ext.grid.EditorGridPanel({
id : 'g',
store: store,
trackMouseOver: true,
...
});
事件代码是这样的:
Ext.getCmp('g').on('click', function (e) {
Ext.getCmp('g').getSelectionModel().selectRow(1);
// this fires error "Uncaught TypeError:
//Ext.getCmp(...).getSelectionModel(...).selectRow is not a function"
}) ;
解决方案
这是线索!您需要重写 RowSelectionModel:
grid = new Ext.grid.EditorGridPanel({
store: myStore,
height: 500,
border: false, frame: false,
cm: myColumnModel,
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
推荐阅读
- ios - 如何以编程方式制作可重用的 UILabel 和 UITextField
- javascript - electron app.on() 未定义错误,如何解决?
- css - 预定义的 CSS 类不起作用 ionic3
- mongodb - 在 Mongo 中投影嵌套文档
- java - 如何在 Intellij 的依赖项中查看源代码(包括注释)
- java - 函数 listitem.getMeasuredHeight() 只给我一行的高度,因为 listitem 是 edittext
- selenium - 在 Katalon Studio 中计算项目、行、用户等
- jquery - 将另一个网站嵌入我的网站的方法
- javascript - 选择从 push.apply([user.email, user.groupName]) 构建的数组的左侧部分
- angular - Object(...) 不是函数 - 在 Module../node_modules/@angular/material/esm5/core.es5.js