Javascript extjs-如何过滤组合框中除选定值之外的网格数据

Javascript extjs-如何过滤组合框中除选定值之外的网格数据,javascript,extjs,checkbox,combobox,Javascript,Extjs,Checkbox,Combobox,ExtJS为网格存储内置了一个名为filter的函数,该函数使用combobox中的选定值过滤网格结果 我想要它的反面。它应该过滤除所选数据之外的网格数据 示例:默认情况下,首先选中所有复选框。当我取消选中任何复选框时,网格应显示除选中复选框之外的数据 var filterArray = []; filterArray.push({ id: 'h2', property: 'vehicle_trafic_light',

ExtJS为网格存储内置了一个名为filter的函数,该函数使用combobox中的选定值过滤网格结果

我想要它的反面。它应该过滤除所选数据之外的网格数据

示例:默认情况下,首先选中所有复选框。当我取消选中任何复选框时,网格应显示除选中复选框之外的数据

var filterArray = [];

filterArray.push({
                   id: 'h2',
                   property: 'vehicle_trafic_light',
                   value: 'Y',     //For Yellow-Ball
                   anyMatch: true,
                   ensitive: false
                 }); 
filterArray.push({
                   id: 'h2',
                   property: 'vehicle_trafic_light',
                   value: 'G',      //For Green-Ball
                   anyMatch: true,
                   ensitive: false
                 });

store.filter(filterArray);

下面是我尝试过的代码,但它使用选中的复选框过滤网格

var filterArray = [];

filterArray.push({
                   id: 'h2',
                   property: 'vehicle_trafic_light',
                   value: 'Y',     //For Yellow-Ball
                   anyMatch: true,
                   ensitive: false
                 }); 
filterArray.push({
                   id: 'h2',
                   property: 'vehicle_trafic_light',
                   value: 'G',      //For Green-Ball
                   anyMatch: true,
                   ensitive: false
                 });

store.filter(filterArray);
如果有人对此有任何建议,请告诉我。

您可以使用。

您可以使用。

您可以使用

filterBy将函数(let call is fun)作为参数,并为存储中的每个记录调用函数fun

store.fliterBy(function(record){
        if(condition to include record)
            return true;                    // record will be included
        else
            return false;                   // record will be excluded
});
并根据该记录的fun返回值对记录进行过滤

所以

  • 如果记录A的fun返回true,则记录A将包含在存储中
  • 如果记录B的fun返回false,则记录B将被排除
  • 您可以使用

    filterBy将函数(let call is fun)作为参数,并为存储中的每个记录调用函数fun

    store.fliterBy(function(record){
            if(condition to include record)
                return true;                    // record will be included
            else
                return false;                   // record will be excluded
    });
    
    并根据该记录的fun返回值对记录进行过滤

    所以

  • 如果记录A的fun返回true,则记录A将包含在存储中
  • 如果记录B的fun返回false,则记录B将被排除