2012-07-26 69 views
0

我有問題爲我的網格配置RowExpander。當網格渲染擴展器已經爲每一行打開並且沒有任何內容。當我點擊它的圖標時,會生成以下錯誤:nextBd爲空。我發現非常類似的問題在這裏http://www.sencha.com/forum/showthread.php?185837-Grid-Panel-PlugIn-Rowexpander-nextBd-is-null但解決方案不工作對我來說,仍然不明白爲什麼插件配置不能在initComponent方法進行傳遞:ExtJS RowExpander - nextBd爲空

這裏是我的網格代碼:



    Ext.define('GSIP.view.plans.PlanReqList' ,{ 
     extend: 'Ext.grid.Panel', 
     alias : 'widget.gsip_devplan_list', 
     id: 'gsip_plan_list', 
     plugins: [{ 
      ptype: 'rowexpander', 
      rowBodyTpl : [ 
       'Nazwa:{name}' 
      ] 
     }], 
     //title:i18n.getMsg('gsip.view.PlanReqList.title'), 
     layout: 'fit', 
     initComponent: function() { 


      this.store = 'DevPlan'; 

    //  this.plugins = [{ 
    //   ptype: 'rowexpander', 
    //   rowBodyTpl : [ 
    //    {name} 
    //   ] 
    //  }]; 

      this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}]; 

      this.tbar = [{ 
       xtype:'commandbutton', 
       id: 'newReq', 
       iconCls:'icon-application_add', 
       text: i18n.getMsg('gsip.view.plans.PlanReqList.addReq'), 
       command: 'newReq', 
      }]; 

      this.viewConfig = { 
       forceFit:true, 
       getRowClass: function(record, index) { 
        var c = record.get('elapsedPercent'); 
        if (c >= 0) {     
         return 'elapsed-normal'; 
        } 
       } 
      } 

      this.columns = [ 
       {header: "Id", dataIndex: "id", width:50, sortable: true, filter:{type:'numeric'}}, 
       {header: i18n.getMsg('gsip.view.plans.PlanReqList.column.name'), dataIndex: "name", flex:1, sortable: true, filter:{type:'string'} }, 

       } 
      ]; 


      this.callParent(arguments); 


     }, 

+0

太棒了,那正是問題所在。你再次幫助我!非常感謝。 – patryks 2012-07-28 21:33:20

回答

3

rowexpander插件使用稱爲rowbody的功能。

在你initComponent()你重寫this.features(已經包括rowbody)這一行:

this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}]; 

因此rowbody功能不包括在內;因此.x-grid-rowbody-tr類不被注入;因此rowexpander找不到nextBd的此類,並返回null。

你應該嘗試:

var iNewFeatures = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}]; 
this.features = iNewFeatures.concat(this.features); 

最後,插件不能在InitComponent()開始,你可以聲明爲CONFIGS,或在構造函數中。有關更多信息,請參見this thread