实现如果修改某一列,修改的时候只显示选中的这一列,修改完之后其他选中的恢复选中状态,直接上代码
selModel: Ext.create('Ext.selection.CheckboxModel', {
allowDeselect:true, //允许用户从一个数据试图,列表或者格子中取消选定一个记录
checkOnly : true, //点击check框才能选中所选行
onHeaderClick: function (headerCt,header,e) {
listeners: {
deselect: function(model,record,index) {//取消选中时产生的事件
if(recflag){
rec = Ext.Array.unique(rec);
Ext.Array.remove(rec,index);
}
},
select: function(model,record,index) {
rec.push(index);
recflag = true;
}
}
}),
initComponent : function() {
var me = this;
var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit : 1,
listeners: {
beforeedit : function(){
recflag = false;
},
edit : function(){
var sub = me.getSelectionModel().getSelection();
if(sub.length>0){
me.getSelectionModel().select(sub[0].index);
if(rec.length>0){
for(var i =0;i<rec.length;i++){
me.getSelectionModel().select(rec[i],true,false);
}
}
}
recflag = true;
}
}
});
}