1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    23
    Vote Rating
    1
    Answers
    1
    English is on a distinguished road

      0  

    Default Unanswered: Filtering a Nested List

    Unanswered: Filtering a Nested List


    This should be a quick question: When filtering the store from which a nested list gets its data, should the nested list update automatically? I can't see any kind of refresh, or reload function.

    I'm simply filtering some JSON with the code below. I can see that the data is being filtered, but the nested list doesn't alter.

    Code:
                AllCoursesButton: {
                    tap: function(button){
                        if(button.getIconCls()=='docs2')
                        {
                            button.setIconCls('doc');
                            button.setText('Mobile Courses');
                            var ActiveStore=this.getCatalogList().getStore();
                            //debugger;
                            ActiveStore.filter('nametxt', 'Mobile Courses');
                            console.log(ActiveStore.getData().length);
                            //ActiveStore.load();
                        }
                        else
                        {
                            button.setIconCls('docs2');
                            button.setText('All Courses');
                            var ActiveStore=this.getCatalogList().getStore();
                            ActiveStore.clearFilter();
                            console.log(ActiveStore.getData().length);
                            //ActiveStore.load();
                        }
                    }
                }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,684
    Vote Rating
    435
    Answers
    3111
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    The NestedList uses TreeStore but each child List uses a Node store so you can filter the Node store on the list for the node. It's not the simplest for the TreeStore.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

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

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    23
    Vote Rating
    1
    Answers
    1
    English is on a distinguished road

      0  

    Default


    Thanks, Mitchell. I'm not sure I understand your answer fully, but, I have just iterated through the node list for the nested list, and removed the items that I want to filter out.

    I have tested (by using "eachChild"), and the node is definitely gone. Yet, there it still sits in the nested list.

    It seems that nothing I do to either the nested list, or the underlying data, has any effect on the items displayed in the nested list once it has been displayed.

    As the documentation is woefully inadequate, I am at a loss. How does one in any way manipulate the items displayed in a nested list, once that list has been displayed?

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    23
    Vote Rating
    1
    Answers
    1
    English is on a distinguished road

      1  

    Default


    Oh well. As Sencha provides no usable documentation, and I can find nothing on the Internet, I'm having to treat the nested list as a dumb component, and simply filtering at the back-end with a parameter to the AJAX call.

Tags for this Thread