您的位置:首页 > 其它

grid.getSelectionModel().getSelected is not a function

2013-11-08 14:44 633 查看
因为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',

}]

});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: