[CLOSED] Filtering a store with nested data

  1. #1

    [CLOSED] Filtering a store with nested data

    I have a dataview hooked up to a store that accepts json in the following format:

    [{
       name: 'CategoryA',
       items: [ {
                     name: 'Child1',
                     id: 'Child1',
                     icon: 'data.png'
                    }, {
                     name: 'Child12',
                     id: 'Child2',
                     icon: 'data.png'
                    }]
     }, {
       name: 'CategoryB',
       items: [ {
                     name: 'Child3',
                     id: 'Child3',
                     icon: 'data.png'
                    }, {
                     name: 'Child4',
                     id: 'Child4',
                     icon: 'data.png'
                    }]
    }]
    How can I filter the store to show only CategoryB with Child4? Dataview.store.filter() only filters the top level and not the child level.
    Last edited by Daniil; Dec 16, 2011 at 6:38 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please always ask any technical support questions on the Premium Help forum since you are a premium member. Otherwise we can miss your question.

    Regarding the question.

    Please use the filterBy method.
    http://docs.sencha.com/ext-js/3-4/#!...ethod-filterBy
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Please always ask any technical support questions on the Premium Help forum since you are a premium member. Otherwise we can miss your question.

    Regarding the question.

    Please use the filterBy method.
    http://docs.sencha.com/ext-js/3-4/#!...ethod-filterBy
    Sorry about that. I was browsing the wrong forum when I created this. FilterBy doesn't work since it is still only working against the first level. Filter eventually calls FilterBy.
  4. #4
    Well, yes. I meant you should use the filterBy method passing a respective function to filter on a level you need.

    Both filter and filterBy methods iterate records to filter, not records data, because it know nothing about internal structure of a record's data.

Similar Threads

  1. Replies: 2
    Last Post: Sep 16, 2012, 3:01 PM
  2. [CLOSED] Nested data in nested grids
    By FAS in forum 1.x Legacy Premium Help
    Replies: 16
    Last Post: Apr 19, 2012, 7:51 PM
  3. Replies: 1
    Last Post: Nov 12, 2010, 12:29 PM
  4. Data disappears after paging and filtering
    By grosenbrock in forum 1.x Help
    Replies: 0
    Last Post: Nov 02, 2010, 3:24 PM
  5. Replies: 1
    Last Post: May 18, 2009, 1:41 PM

Posting Permissions