2014-04-29 3 views
0

를 조작 할 수 센차 터치 모델 내부의 자동 초기화 기능 추가 그 json 객체의 토큰.모델의 데이터

그 때문에 모델 내부에 함수를 작성해야한다고 생각합니다.

저장소를로드 할 때 데이터를 조작하고 토큰을 추출하려면 어떻게해야합니까?

답변

0

나는 비슷한 상황에 직면했다. 1 시간 전, 나는로드하는 동안 또는 immidiatly 후에 데이터를 편집해야했다. 이 솔루션으로 끝났습니다.

Ext.define('TestApp.store.MyStore', { 
    extend: 'Ext.data.Store', 
    requires: ['TestApp.model.SecretKeyModel'], 
    config :{ 
     model: 'TestApp.model.SecretKeyModel', 
     proxy: { 
      type: 'ajax', 
      url: TestApp.utils.GlobalVariables.getServerUrl(), 
      reader: { 
       type: 'json', 
       rootProperty: '' 
      } 
     }, 
     listeners: { 
      refresh: function(store, data, eOpts) { 
       store.each(function (item, index, length) { 
        item.extractToken(); // call this on every record loaded in the store 
       }); 
      } 
     } 
    } 
}); 
관련 문제