我在选项卡面板中添加多个网格(每个网格中的cellplugin)并显示它。 但是当我点击单元格进行编辑时,它不会显示文本区域。
我也将编辑器配置为文本区域。
我尝试调试插件并在下面的代码中找到问题(Editing.js) -
startEdit: function(record, columnHeader) {
var me = this,
context,
layoutView = me.grid.lockable ? me.grid : me.view;
// The view must have had a layout to show the editor correctly,
// defer until that time.
// In case a grid's startup code invokes editing immediately.
if (!layoutView.componentLayoutCounter) {
layoutView.on({
boxready: Ext.Function.bind(me.startEdit, me, [record, columnHeader]),
single: true
});
return false;
....
....
}
问题是componentLayoutCounter的值为0,因为如果执行了块,则返回false,停止编辑。
我的查询是如何确保componentLayoutCounter值始终正确设置?
答案 0 :(得分:0)
这是一年之后,但是如果有人遇到这个错误,那么这就是覆盖的解决方案。它检查布局是否初始化以及componentLayoutCounter:
Ext.override(Ext.grid.plugin.Editing, {
startEdit: function(record, columnHeader) {
var me = this,
context,
layoutView = me.grid.lockable ? me.grid : me.view;
//BUGFIX: added check to make sure componentLayout is not initialized before denying edit.
if (!layoutView.componentLayoutCounter && !layoutView.componentLayout.initialized) {
layoutView.on({
boxready: Ext.Function.bind(me.startEdit, me, [record, columnHeader]),
single: true
});
console.log(layoutView.componentLayoutCounter,'componentLayoutCounter not set, so not starting edit',me.view,me,me.view.componentLayout);
return false;
}
// If grid collapsed, or view not truly visible, don't even calculate a context - we cannot edit
if (me.grid.collapsed || !me.grid.view.isVisible(true)) {
//console.log('either the grid is collapsed ',me.grid.collapsed,' or not visible ',me.grid.view.isVisible);
return false;
}
context = me.getEditingContext(record, columnHeader);
//console.log('trying to find context',context,' from ',record,columnHeader);
if (context == null) {
return false;
}
if (!me.preventBeforeCheck) {
if (me.beforeEdit(context) === false || me.fireEvent('beforeedit', me, context) === false || context.cancel) {
return false;
}
}
return context;
}
});