2014-11-11 3 views
0

Я добавляю несколько таблиц (cellplugin в каждой сетке) на вкладке и отображаю их. Однако, когда я нажимаю на ячейку для редактирования, она не отображает текстовую область.Ext JS 4.2 componentLayoutCounter

Я также настроил редактор как текстовую область.

Я пытался отладки плагина и обнаружил проблему (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 из-за того, что если блок запускается на выполнение и возвращается ложь, которая прекращает редактирование.

Мой запрос заключается в том, как мы можем гарантировать правильность установки значения componentLayoutCounter?

ответ

0

Это год спустя, но если кто-то попадает в ошибку, вот решение в переопределении. Он проверяет, инициализирована ли компоновка, а также компонентLayoutCounter:

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; 
} 

});

Смежные вопросы