2
我的表单中有一个带有CheckboxSelectionModel的网格面板。我正在使用ExtJs 3.4。这是我的网格面板。CheckboxSelectionModel ExtJs中的网格:无法选中网格面板中的复选框,选中标题复选框时将检查所有行
var selectModel = new Ext.grid.CheckboxSelectionModel();
var drop_pick_grid = new Ext.grid.GridPanel({
store : dropPickGridStore,
cm : new Ext.grid.ColumnModel([ selectModel, {
sortable : true,
header : "Drop/Pick Loc",
dataIndex : 'locationName',
width : 170,
renderer : function(value, metaData, record, rowIndex,
colIndex, store) {
var refColor = record.data.tourTypeColor;
//console.log(record);
metaData.attr = 'style="background-color:' + refColor + ';"';
return record.get('locationName');
}
}, {
header : "Town/City",
sortable : true,
dataIndex : 'city',
width : 120
}, {
header : "Address",
sortable : true,
dataIndex : 'addr',
width : 170
}, {
header : "EST.Un/Load Time",
sortable : true,
dataIndex : 'estimatedTime',
width : 100
} ]),
sm : new Ext.grid.CheckboxSelectionModel(),
//width : 570,
//height : 390,
autoHeight : true,
autoWidth : true,
frame : true,
iconCls : 'icon-grid',
renderTo : document.body
});
此网格使用Json从postgresql数据库加载。
var dropPickGridStore = new Ext.data.JsonStore({
fields : [ {
name : 'locationCode'
}, {
name : 'locationName'
}, {
name : 'city'
}, {
name : 'addr'
}, {
name : 'estimatedTime'
}, {
name : 'tourTypeColor'
} ],
root : 'dropPickLoc',
idProperty : 'locationCode',
//autoDestroy : true,
autoLoad : true,
proxy : new Ext.data.HttpProxy({
url : "http://" + host + ":" + port + "/" + projectName + "/"
+ "PendingDropPicks"
}),
reader : {
type : 'json',
root : 'dropPickLoc'
//idProperty : 'locationName',
},
});
网格成功加载。问题是我无法检查网格中的复选框,但它可以通过单击标题复选框来选择所有行。为什么它不能单独检查每一行。
rixo,我已经尝试过这一点。但后来我无法检查网格的任何复选框。我只能挑选标题复选框 – Rose18
这应该起作用。但为什么这对我不起作用 – Rose18
在我的dropPickGridStore中是否有任何错误 – Rose18