lockinggrid锁定列的最前面加checkbox,但是checkbox不能点击,求解
下面是自己参考网上的信息,做出来的一个lockinggrid的例子,我想在lockinggrid锁定列的最前面加checkbox,代码如下,但是效果出来了,但是checkbox不能点击,请问该如何解决?Ext.ns("test.LGAC");
var listSm = new Ext.grid.CheckboxSelectionModel({
header: "",
handleMouseDown: function(g, rowIndex, e) {
if (e.button !== 0 || this.isLocked()) { return; }
var view = this.grid.getView();
if (e.shiftKey && !this.singleSelect && this.last !== false) {
var last = this.last;
this.selectRange(last, rowIndex, e.ctrlKey);
this.last = last;
view.focusRow(rowIndex);
} else {
var isSelected = this.isSelected(rowIndex);
if (isSelected) {
this.deselectRow(rowIndex);
} else if (!isSelected || this.getCount() > 1) {
this.selectRow(rowIndex, true);
view.focusRow(rowIndex);
}
}
},
isLocked: Ext.emptyFn,
initEvents: function() {
Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);
this.grid.on('render', function() {
var view = this.grid.getView();
view.mainBody.on('mousedown', this.onMouseDown, this);
Ext.fly(view.lockedInnerHd).on('mousedown', this.onHdMouseDown, this);
}, this);
}
});
listSm.lock();
test.LGAC.main= function(){
function createwin(){
var mainWin=new Ext.Window({
title:'grid锁定列+选择框',
width:615,
height:'100%',
closable:false,
layout:'column',
items:[lockGrid]
});
mainWin.setPosition(10,10);
mainWin.show();
}
return {
init :function(){
doLockGrid();
createwin();
}
}
function doLockGrid(){
var myData = {
records : [
{ userName : "Rec 0", userId : "3504000",userPassword:'123456',userScore : "4350" },
{ userName : "Rec 1", userId : "3504001",userPassword:'123456',userScore : "5641" },
{ userName : "Rec 2", userId : "3504002",userPassword:'123456',userScore : "4572" },
{ userName : "Rec 3", userId : "3504003",userPassword:'123456',userScore : "6443" },
{ userName : "Rec 4", userId : "3504004",userPassword:'123456',userScore : "5474" },
{ userName : "Rec 5", userId : "3504005",userPassword:'123456',userScore : "5565" },
{ userName : "Rec 6", userId : "3504006",userPassword:'123456',userScore : "7666" },
{ userName : "Rec 7", userId : "3504007",userPassword:'123456',userScore : "6577" },
{ userName : "Rec 8", userId : "3504008",userPassword:'123456',userScore : "3458" },
{ userName : "Rec 9", userId : "3504009",userPassword:'123456',userScore : "4359" }
]
};
fields = [
{name: 'userName', mapping : 'userName'},
{name: 'userId', mapping : 'userId'},
{name:'userPassword',mapping:'userPassword'},
{name: 'userScore', mapping : 'userScore'}
];
var store = new Ext.data.JsonStore({
data : myData,
root : 'records',
fields : fields
});
lockGrid=new Ext.grid.LockingGridPanel({
width:600,height:350,layout:'fit',frame:true,border:true,enableHdMenu : false,
autoScroll:true,bodyStyle :'overflow-x:scroll',store:store,
sm : listSm,
columns : [listSm,
{header:'名称',locked : true,dataIndex:'userName',width:80},
{header:'ID号',locked : true,dataIndex:'userId',width:80},
{header:'密码',dataIndex:'userPassword',width:100},
{header:'积分',dataIndex:'userScore',width:80}
],
stripeRows: true,
view: new Ext.grid.LockingGridView()
});
}
}();
Ext.onReady(test.LGAC.main.init,test.LGAC.main);
在论坛上有看过解决方案说是改LockingGridView的initElements方法,但是我试过了不行,不知道问题出现在哪,求大侠帮忙解答,万分感谢 --------------------编程问答-------------------- 求大侠帮忙解答,万分感谢
补充:Java , Java相关