【问题标题】:How to get last six months of store?如何获得最后六个月的商店?
【发布时间】:2013-12-11 10:19:24
【问题描述】:

我想用 Month 值过滤我的商店:

//On clicking the Last Six Months period button
onLsmClick: function () {
    var chart = Ext.widget('drawchart');
    var chartStore = this.getGraphDataStore();
    chartStore.clearFilter(true);

    chartStore.filter([{
        filterFn: function (item) {
            return (item.get('Month') >= ?????  && (item.get('Month') < ?????)
        }
    }]);
    chartStore.sync = true;
    chart.redraw();
    chart.refresh();
},

【问题讨论】:

    标签: javascript extjs filter store


    【解决方案1】:
    //Finding right month
    chartStore.filterBy(function(record){
           var index = chart
           return record.getData().Month >= ???? && record.getData().Month < ????;
    });
    
    //Finding last 6 records
    var count = chartStore.getCount();
    chartStore.filterBy(function(record){
           var index = chartStore.find('Month', record.month, 0, false, true, true); //Get current index of record based on month
           return index >= count - 6;
    });
    

    请参阅文档中的此链接 http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-method-filterBy

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-07
      • 1970-01-01
      • 1970-01-01
      • 2011-01-30
      • 1970-01-01
      • 2012-07-17
      相关资源
      最近更新 更多