最近在开发过程中遇到一个问题,就是在使用Ext.grid.GridPanel组件时,在为该组件配置了sm属性时,selectionchange时间会被多次触发。后面检查代码发现:原来是在表格组件中同时开启了 enableDragDrop:true 时会导致selectionchange会被多次触发。
下面贴出我的代码中的错误
ext版本是2.x
this.imageEditorGrid.grid = new Ext.grid.EditorGridPanel({
layout:'fit',
region:'south',
height:200,
split:true,
collapsible:true,
enableDragDrop:false,//开启此项会导致new Ext.grid.CheckboxSelectionModel 组件中的selectionchange事件多次触发
enableColumnMove:false,
ddGroup:'image-editor-grid',
enableHdMenu:false,
collapseMode:'mini',
store:this.imageEditorGrid.store,
cm:this.imageEditorGrid.cm,
sm:new Ext.grid.CheckboxSelectionModel({
listeners:{
selectionchange:this.onSelectionChange.createDelegate(this) //如果开启enableDragDrop:true会发现表格前面的复选框选中之
//后无法撤销,而且该事件还会被多次触发。
}
}),
autoExpandColumn:'ad_url',
listeners:{
render:this.afterImageEditorGridRender.createDelegate(this)
}
});

本文探讨了在使用ExtJS 2.x版本的GridPanel组件时遇到的问题,即当启用了enableDragDrop属性和CheckboxSelectionModel的选择模型时,selectionchange事件会多次触发,并且复选框无法正常取消选择。
148

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



