2017-04-25 6 views
1

こんにちは、「メールから」という単語を含む名前のキーワードに基づいてデータをフィルタリングするフィルタを2つ含んでいます。反復ボックスで私はそれをしようとしましたが、グリッドは私が使用したコードのデータを表示しません:名前のキーワードに基づいてデータをソートしてフィルタリングする

Ext.define('CustomApp', { 
extend: 'Rally.app.App', 
componentCls: 'app', 
grid: null, 

launch: function() { 

    var filters = []; 
    var timeboxScope = this.getContext().getTimeboxScope(); 

    if(timeboxScope) { 
     filters.push(timeboxScope.getQueryFilter()); 
    } 

    this.getFilteredStoryModel(filters);    
}, 

onTimeboxScopeChange: function(newTimeboxScope) {    
    var newFilters = []; 
    var updatedTimeboxScope = this.getContext().getTimeboxScope(); 
    if (this.grid) { 
     this.grid.destroy(); 
    }     
    if (updatedTimeboxScope) { 
     newFilters.push(newTimeboxScope.getQueryFilter()); 
    } 
    this.getFilteredStoryModel(newFilters); 
}, 
getFilteredStoryModel:function(queryFilters){ 

Ext.create('Rally.data.wsapi.Store', { 
fetch: ['FormattedID','Name','Owner','ScheduleState'], 
model:"User Story", 
      filters: queryFilters, 
      autoLoad:true, 
      listeners:{ 
       load:function(myStore,myData,success){ 
        console.log("got data:",myStore,myData,success); 
        //the data is got and store in myStore if success. and the _loadTagSummary is called with the myStore pass into it 
        this.displaydata(myStore); 
       }, 
       scope:this 
      }, 
    }); 
}, 
displaydata:function(mystorystore){ 
     this.grid = this.add({ 
          xtype: 'rallygrid', 
          model: mystorystore, 
          columnCfgs: [ 
           'FormattedID', 
           'Name', 
           'Owner' 
          ], 
          storeConfig: { 
           filters: [ 
            { 
             property: 'Name', 
             operator: '=', 
             value: 'From Mail' 
            } 
           ] 
          } 
         }); 

} 

});

は助けてくれてありがとうあなたが私はあなたが指定しようとして周りonTimeboxScopeChange(親メソッド呼び出しではない)ともいくつかのすごみの微妙なバグがアップトリップなっていると思うオフスーパー遠くじゃない

答えて

0

グリッド上のstoreとstoreConfigの両方。私はこれを支援するために、ドキュメントのいくつかの異なる例を使用

Ext.define('CustomApp', { 
    extend: 'Rally.app.App', 
    componentCls: 'app', 

    layout: 'fit', //take up all available space 

    launch: function() { 
     this._addGrid();    
    }, 

    onTimeboxScopeChange: function(newTimeboxScope) { 
     this.callParent(arguments); //super important, or timebox scope in context doesn't ever get updated! 

     this._refreshGrid(); 
    }, 

    _addGrid: function() { 
     this.add({ 
      xtype: 'rallygrid', 
      model: 'User Story', 
      columnCfgs: [ 
       'FormattedID', 
       'Name', 
       'Owner' 
      ], 
      storeConfig: { 
       filters: this._getFilters() 
      } 
     }); 
    }, 

    _getFilters: function() { 
     var filters = [ 
      { 
       property: 'Name', 
       operator: '=', 
       value: 'From Mail' 
      } 
     ]; 

     var timeboxScope = this.getContext().getTimeboxScope();     
     if (timeboxScope) { 
      filters.push(timeboxScope.getQueryFilter()); 
     } 

     return filters; 
    }, 

    _refreshGrid: function() { 
     var grid = this.down('rallygrid'), 
      store = grid.getStore(); 

     store.clearFilter(true); 
     store.filter(this._getFilters()); 
    } 
}); 

:ここ

は私が思いついたものだ

+0

キーワードに基づいてフィルタリングすることは可能ですか名前から「メールから」? – Jonathan

+0

これは、_getFilters関数がやっていることです。これには、Name = From Mailフィルタと、利用可能な場合はタイムボックスフィルタが含まれます。あなたは正確な名前の一致のために=の代わりに演算子を含むように演算子を変更することもできます。 –

+0

演算子は何ですか? – Jonathan

関連する問題