2014-07-24 1 views
1

내 Rally 사용자 지정 데이터 저장소가 업데이트되지 않습니다. [이] [1] 게시물에 설명 된 문제가있는 임.Rally 사용자 지정 데이터 저장소가 업데이트되지 않습니다.

내 시나리오는 다음과 같습니다. 사용자 지정 데이터 저장소가있는 표에 행을 추가합니다. 그리드 열을 정렬하면 내가 추가 한 모든 새 행이 삭제됩니다. 내 맞춤 상점에 대한 멋진 점은 없으며 autoSync를 사용해 보았습니다. 사실이지만 아무것도하지 않습니다.

원본 데이터의 변경 사항이 일시적이며 reload()로 삭제된다는 점에서 사용자 지정 저장소가 읽기 전용입니까?

내가 메모리 프록시 소스 코드를 보았다 rallygrid

 me.customStore = Ext.create('Rally.data.custom.Store', { 
      data: customData, 
      listeners:{ 
       load: function(customStore){ 
        //do some stuff 
       } 
      } 
     }); 

답변

1

에 추가하고 아무것도 추가하거나 제거 또는 Rally.data.custom.Store 저장소와 제대로 업데이트하기 이유 의미가 나의 저장소입니다. 메모리 프록시의 작성 W 파기 메소드를 대체해야합니다.

현재 메모리 PROXY 기능

이러한 메모리 프록시에 대한 기록을 생성하고 파괴하는 데 사용되는 함수입니다. 당신이 볼 수 있듯이, 그들은 ... 만들거나 기록을 파괴 해달라고

updateOperation: function(operation, callback, scope) { 
    var i = 0, 
     recs = operation.getRecords(), 
     len = recs.length; 

    for (i; i < len; i++) { 
     recs[i].commit(); 
    } 
    operation.setCompleted(); 
    operation.setSuccessful(); 

    Ext.callback(callback, scope || this, [operation]); 
},  

create: function() { 
    this.updateOperation.apply(this, arguments); 
}, 

destroy: function() { 
    this.updateOperation.apply(this, arguments); 
}, 

올바른 메모리 PROXY 설정

다음

실제로 사용자 정의 레코드를 추가하고 제거하는 사용자 정의 저장소를 인스턴스화하는 방법입니다 상점

me.customStore = Ext.create('Rally.data.custom.Store', { 
     data: //customData 
     model: //modelType 
     autoSync:true, 
     proxy: { 
      type:'memory', 
      create: function(operation) { 
       var me = this; 
       operation.getRecords().forEach(function(record){ 
        console.log('adding record', record); 
        me.data.push(record); 
       }); 
       this.updateOperation.apply(this, arguments); 
      }, 
      destroy: function(operation) { 
       var me = this; 
       operation.getRecords().forEach(function(record){ 
        console.log(record); 
        for(var i = 0;i<me.data.length;++i){ 
         if(/*me.data[i] == record*/){ 
          me.data.splice(i, 1); 
          return; 
         } 
        } 
       }); 
       this.updateOperation.apply(this, arguments); 
      } 
     }, 
     listeners://listener stuff here 
    });