因为Extjs 的Ext.grid.EditorGridPanel默认是行选择,所以如果你点击一个CELL再用这个方法是会报错的,解决方法是在grid定义时加上
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
就可以用grid.getSelectionModel().getSelected这个方法了,具体代码如下:
var grid = new Ext.grid.EditorGridPanel({
id: ‘stylegrid’,
wdith:290,
height:290,
store : gridstore,
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
columns: [
{
header: 'apBasicId',
dataIndex: 'apBasicId',
hidden: true,
},{
header:'款号',
width: 100,
sortable: true,
dataIndex: 'style',
},{
header:'款号名字',
width: 100,
sortable: true,
dataIndex: 'stylename',
}]
});
本文介绍如何在Extjs的EditorGridPanel中设置单行选择模型以避免点击单元格时出现错误,并提供了一个具体的实现代码示例。
5017

被折叠的 条评论
为什么被折叠?



