extjs - 无法检索网格中的选定记录
问题描述
我正在使用 ExtJS 7.1 并创建了一个网格面板。我无法使用代码 Ext.getCmp("tempGrid").getSelectionModel().getSelection() 检索选定的行,这行代码始终返回长度为 0。
Ext.getCmp("tempGrid").getSelectionModel().hasSelection(),这行代码总是返回false。
我不知道出了什么问题,想寻求建议或建议。谢谢
我有一个选项卡面板作为主面板(mainPanel),然后我附加/链接了另一个面板(称为 tempGrid) 在 tempGrid 内,我将放置网格,这是网格配置
items: {
xtype: 'gridpanel',
id: 'tempGrid',
header: false,
forceFit: true,
store: 'AStore',
columns: [{
xtype: 'gridcolumn',
dataIndex: 'colA',
text: 'A Column',
filter: {
type: 'string'
}
},
{
xtype: 'gridcolumn',
dataIndex: 'colB',
text: 'B Column',
filter: {
type: 'string'
}
}
],
plugins: [{
xtype: gridfilters ''
}],
dockedItems: [{
xtype: 'pagingtoolbar',
dock: 'bottom',
displayInfo: true,
inputItemWidth: 80,
store: 'AStore'
}]
}
解决方案
您的网格配置示例中的网格具有 id APanel
。你必须打电话
Ext.getCmp("APanel").getSelectionModel().getSelection()
获取选定的记录。我想tempGrid
是另一个你的网格
推荐阅读
- c - 指针非法访问 PIC32 上的数组
- java - 如何使用 CardLayout 将 JPanel 从另一个类添加到面板?
- swagger-ui - 如何在 OpenAPI 3.0 中记录 RFC3339 日期时间输入?
- reactjs - 无法设置状态以响应字符串数组
- typescript - 尽管声称 Prettier 不支持私有方法
- angular6 - angular6不刷新css更改
- git - “与您的容器共享 Git 凭据”不起作用
- jenkins - Jenkins 声明式管道 ssh 代理插件
- mysql - NodeJS Mysql pool.query() 没有释放连接?
- python - Django Auth Group 拒绝更改 UpdateViews