2015-06-29 22 views
0

我有一個屬性網格:ExtJS的屬性網格重裝後呈現

periods.each(function(record){ 

var tempPropGrid = me.getView().add(
    { 
     xtype:'propertygrid', 

     width: 80, 
     header: false, 
     title: 'prop grid', 
     //for some reason the headers are not hiding, we may need to deal with this using CSS 
     //hideHeaders: true, 
     enableColumnResize: false, 
     sortableColumns: false, 
     nameColumnWidth: 1, 
     source: record.data, 
     sourceConfig: { 

      periodScrumMaster: { 
       editor: Ext.create('Ext.form.ComboBox', { 
        tdCls: 'red', 
        store: team, 
        queryMode: 'local', 
        displayField: 'personName', 
        valueField: 'personName', 

        listeners: { 
         'expand' : function(combo) { 
          var gridvalues = this.up('propertygrid').getSource(); 
          combo.getStore().clearFilter(true); 
          combo.getStore().addFilter({property: 'teamName', value: teamName}); 
          combo.getStore().addFilter({property: 'periodName', value: gridvalues.periodName}); 
          var totalFTE = team.count(); 
          console.log(totalFTE); 
          var teamStore = Ext.getStore('personPeriods'); 
          console.log('store'); 
          console.log(teamStore); 
         }, 
        }}), 
       displayName: 'Scrum Master' 
      }, 



     }, 

具有使聽衆:

beforerender: function(){ 

調試;

   var gridValues = this.getSource(); 
       // console.log(record); 
       //debugger; 


       // filter periods for this period only 
       periods.filterBy(function(record,id){ 
        if(record.get("periodName") === gridValues.periodName){ 
         return true; 
        }}); 

       // filter teamMembers for this period and team 
       var view = this.up(); 
       var vm = view.getViewModel(); 
       var store = vm.getStore('teamMembers'); 
       store.filterBy(function(record,id){ 
        if(record.get("periodName") === gridValues.periodName) { 
         return true; 
        }}); 
       //store.clearFilter(true); 
       store.addFilter({property: 'teamName', value: teamName}); 
       // get FTEs assigned to this team in this period by counting records 
       var resourcedFtes = store.count(); 


       // Here I check the record in the periods store to make sure the data matches up with how many resourcedFte there is an update it if required 
       // This is super bad and will need to refactor 
       periods.each(function(record,idx){ 
        var value = record.get('resourcedFte'); 
        if(value != resourcedFtes){ 
         record.set('resourcedFte',resourcedFtes); 
         record.commit(); 
         vm.data.parentController.saveParent(); 

        }}); 
       // Need to call save parent so that the record is updated when we update it above 

       //Clear everything so that we can start fresh next period 
       store.clearFilter(true); 
       //periods.clearFilter(true); 

基本上有一定的邏輯來檢查數據是否正確/最新的,如果它不將更新它。這工作正常,但數據不會然後加載到網格中。爲了正確加載網格,我必須刷新網格。

有沒有一種方法可以調用屬性網格上的刷新或重新加載方法以在if語句內再次加載數據?

回答

0

如果我理解你的問題,我會建議你編程存儲代理,以便它返回整個更改的記錄。
您的商店是否啓用autoLoad參數?
(抱歉,我不能評論)