2013-03-26 75 views
3

加载数据我想用ExtJS的插件“RowExpander”,但是,我会加载数据时,该事件expandbody被激发。 我已经尝试此代码,但我不知道如何设置rwoBody的扩展内容:ExtJS的4.2.0 RowExpander动态

this.GridPrincipal.getView().addListener('expandbody', function (rowNode, record, expandRow, eOpts) { 


     Ext.Ajax.request({ 
      url: 'getData/' + record.get('id'), 
      method: 'POST', 
      success: function (result, request) { 
      // retrive the data 
      var jsonData = Ext.util.JSON.decode(result.responseText); 
      //code to change the text of the RowBody 
          //.... 
      }, 
      failure: function (result, request) { 
      Ext.MessageBox.alert('Failed', result.responseText); 
      return false; 
      } 
      }); 



    }); 

非常感谢你。

回答

1

我有同样的问题。我的解决方案是:

Ext.get(expandRow).setHTML('New Text'); 

我会很乐意听到有没有更好的方法。

3

一个解决方案,使用它可以提供任何数据,甚至其他组件进入扩张是给它分配股利。

plugins: [{ 
     ptype: 'rowexpander', 
     rowBodyTpl: ['<div id="ux-row-expander-box-{id}"></div>'], 
     expandOnRender: true, 
     expandOnDblClick: true 
    }] 

其中'id'是商店的id字段。

上expandbody事件未来

,您可以使用例如获取数据Ajax请求,然后使用renderTo配置将包含数据的面板或网格等渲染到此div中。