Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8969277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:34:12+00:00 2026-06-15T17:34:12+00:00

Iam trying to apply several filter which I get from a localStorage store. I

  • 0

Iam trying to apply several filter which I get from a localStorage store.

I load the store and can apply some filters:

var newsStore = Ext.getStore("cityStore");

newsStore.filter(Ext.create('Ext.util.Filter', {
  filterFn: function(item) {
    return item.get('name') == 'city1' || item.get('name') == 'city2';  
}
}));

But now I have a list of items and would like to iterate through all items in the list and apply them to the store filter.

The problem is imho that I cannot iterate though a loop and do return item.get(‘name’) == ‘variable’ again and again because this would only filter for the last return but I would like to apply every item in the list as the filter seen above.

Hope I can find some help here…

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:34:12+00:00Added an answer on June 15, 2026 at 5:34 pm

    Imaging you have an array containing the names you have to use for filtering the store, we will call this array ‘names’:

    var names = ['Lucas', 'Pablo', 'Noelia'];
    

    What you have to do in your filterFn is return true if the record contains some of the values listed in your names array. The magic is in the some function.

    store.filter(Ext.create('Ext.util.Filter', {
      filterFn: function(item) {
          return names.some(function(name){ return name === item.get('name')});  
      }
    }));
    

    For example, the following store will only contain 2 rows (after apply the filter): Lucas and Pablo:

    var names = ['Lucas', 'Pablo', 'Noelia'];
    
    var store = Ext.create('Ext.data.ArrayStore', {
        fields: ['id', 'name'],    
        data: [
            [ 1, 'Lucas' ],
            [ 2, 'Pablo' ],
            [ 3, 'Francisco' ]
        ]
    });
    
    store.filter(Ext.create('Ext.util.Filter', {
      filterFn: function(item) {
          return names.some(function(name){ return name === item.get('name')});  
    }
    }));
    
    // display the filtered record in the console
    store.each(function(record){ console.log(record.get('name'))})​
    

    You also can do it working here: http://jsfiddle.net/lontivero/5TWq9/3/

    I hope this is useful.
    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to apply smoothing filter to image . But I get this
I am trying to apply filters to employees to show them just on the
I am trying to apply some transformations on images using a CGContextRef. I am
I am trying to apply a method to an existing object which involves using
i am trying to apply some condition for an Auto generated textfield, the script
I am trying to get iCloud to work with my app, which needs to
I am trying to process an xml file which has several different state groups
I am trying to find a way to apply background resources to several buttons.
I am trying to apply some jquery to my code.... <script type=text/javascript> alert($('.thickbox')); </script>
I am trying to understand how exactly normalization works and apply it in some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.