【问题标题】:Store filter in sencha touch (multiple items)在煎茶触摸中存储过滤器(多项)
【发布时间】:2016-01-11 04:54:41
【问题描述】:

我看到了这个问题,我想更进一步 https://stackoverflow.com/questions/18606212/store-filter-in-sencha-touch#=

首先我过滤该表(目前为止有效):

然后我将根据第一个表的过滤器过滤另一个表。

结果将是:

或(例如):

现在我测试了类似的东西:

TABLEVIEWSTORE1.filter("name", name);

   TABLEVIEWSTORE1.load({callback: function (){
       tableviewstore2.load({callback: function (){

       TABLEVIEWSTORE1.each(function(item){
           tableviewstore2.filterBy(function(record,id){
               return record.get("number") == item.get("number");
           }, this);
       });

        TABLEVIEWSTORE1.load({callback: function (){
            tableviewstore2.load({callback: function (){
                    // DO MORE THINGS
            }});
        }});
           }});

    }});
});

有人知道它是如何正常工作的吗?

【问题讨论】:

    标签: extjs sencha-touch store


    【解决方案1】:

    首先,我们应该从第一个过滤的商店中找到所有唯一编号。 然后,我们应该根据这些唯一数字数组过滤第二个商店。 我们将为此使用Ext.Array

    var uniqueNumbers= [];       
        TABLEVIEWSTORE1.each(function(item){
                 Ext.Array.include(uniqueNumbers,item);
        });
        tableviewstore2.filterBy(function(record){
                       return Ext.Array.contains(uniqueNumbers,record.get("number"));
                   });
    

    【讨论】:

    • 它有效。非常感谢 :) 我只更改了 Ext.Array.include(uniqueNumbers,item.get("number"));
    猜你喜欢
    • 1970-01-01
    • 2015-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-25
    • 2012-11-04
    • 1970-01-01
    相关资源
    最近更新 更多