Results 1 to 3 of 3

Thread: How to filter nested data?

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    16
    Vote Rating
    0
      0  

    Default Answered: How to filter nested data?

    Hi I have nested data loaded into my store using hasMany association. I'm having an issue trying to filter the data. When I look at the main store I noticed my hasMany associations have there own stores inside my main store. I've tried filtering my main store but the record it returns just contains the stores for my associations. So I tried filtering on my association stores but nothing happens. I tried someStore.getData().items[0].thatStore.filterBy(), and just printing out the record but nothing happens. When I print out the association stores they contain the relevant data I'm just not sure how to filter it.

  2. When you have associations, the data no longer belongs to the record, it is then kept in it's own store that is cached on the record. You will not be able to filter the main store for associated data. You would have to loop through each record and filter each store.

    Are you using a DataView/List to display the main data including the associated data?

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    When you have associations, the data no longer belongs to the record, it is then kept in it's own store that is cached on the record. You will not be able to filter the main store for associated data. You would have to loop through each record and filter each store.

    Are you using a DataView/List to display the main data including the associated data?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    16
    Vote Rating
    0
      0  

    Default

    Thanks for the response I realized it after awhile. I tried using the filter and filterby on the stores inside my main store but it didn't work so I just did my only filter by looping through all the data.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •