【发布时间】:2020-03-31 10:43:50
【问题描述】:
我正在使用 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'
}]
}
【问题讨论】:
-
这个问题可能看起来很傻,但同时您在网格中选择了行?
-
是的,我选择了网格中的一行,然后使用 Chrome 控制台执行“Ext.getCmp("tempGrid").getSelectionModel().hasSelection()”,结果为假。我也尝试过“Ext.getCmp("tempGrid").getSelectionModel().getSelection()”,但长度为 0
-
你能举个网格配置的例子吗?
-
嗨,我已将网格配置复制到我的问题中。请指教。非常感谢
标签: extjs sencha-architect extjs7