2013-03-26 3 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

데이터 또는 다른 구성 요소를 확장기에 렌더링 할 수있는 하나의 솔루션은 div에 할당하는 것입니다.

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

여기서 'id'는 상점의 ID 필드입니다.

다음 expandbody 이벤트에서 예를 들어를 사용하여 데이터를 가져올 수 있습니다. Ajax가 요청한 다음 renderTo 구성을 사용하여이 div에 데이터가 들어있는 패널이나 눈금 등을 렌더링합니다.

관련 문제