1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    10
    Vote Rating
    0
    peterarsentev is on a distinguished road

      0  

    Default TreeGrid setExpandOnFilter(false) after filtering don't open leafs

    TreeGrid setExpandOnFilter(false) after filtering don't open leafs


    Hello I have a strange behavior in TreeGrid when I set setExpandOnFilter(false). It does not open leafs after filtering.
    I made a maven project where you can testing it.
    http://www.2shared.com/file/sP9XAVt2/TreeMX.html

    How to repeat bug.
    1. unpack
    2. go to TreeMX
    3. mvn gwt:run
    4. inter 0 in filters field
    5. try to open node after filtering.

    Please check it and fix it.

    Regard.

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Can you please post just the required EntryPoint class as plain text here?

    The testcase should just be a single class implementing EntryPoint.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    10
    Vote Rating
    0
    peterarsentev is on a distinguished road

      0  

    Default


    Yes sure
    Code:
    package com.sample.tree.client;
    
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.IsWidget;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.Widget;
    import com.sample.tree.client.model.TopMXItem;
    import com.sencha.gxt.core.client.ValueProvider;
    import com.sencha.gxt.data.shared.ModelKeyProvider;
    import com.sencha.gxt.data.shared.Store;
    import com.sencha.gxt.data.shared.TreeStore;
    import com.sencha.gxt.widget.core.client.button.ButtonBar;
    import com.sencha.gxt.widget.core.client.button.TextButton;
    import com.sencha.gxt.widget.core.client.container.FlowLayoutContainer;
    import com.sencha.gxt.widget.core.client.container.MarginData;
    import com.sencha.gxt.widget.core.client.event.SelectEvent;
    import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
    import com.sencha.gxt.widget.core.client.form.StoreFilterField;
    import com.sencha.gxt.widget.core.client.tree.Tree;
    
    
    public class TreeMX implements IsWidget, EntryPoint {
    
    
        class KeyProvider implements ModelKeyProvider<TopMXItem> {
            public String getKey(TopMXItem item) {
                return item.get("id");
            }
        }
    
    
        public Widget asWidget() {
            FlowLayoutContainer con = new FlowLayoutContainer();
    
    
            TreeStore<TopMXItem> store = new TreeStore<TopMXItem>(new KeyProvider());
            for (int i=0;i!=10;++i) {
                TopMXItem item = new TopMXItem(String.valueOf(i), "parent"+i);
                store.add(item);
                processFolder(store, item);
            }
    
    
            StoreFilterField<TopMXItem> filter = new StoreFilterField<TopMXItem>() {
                @Override
                protected boolean doSelect(Store<TopMXItem> topMXItemStore, TopMXItem topMXItem, TopMXItem topMXItem1, String s) {
                    return topMXItem1.get("name").toString().contains(s);
                }
            };
            filter.bind(store);
    
    
            final Tree<TopMXItem, String> tree = new Tree<TopMXItem, String>(store, new ValueProvider<TopMXItem, String>() {
    
    
                public String getValue(TopMXItem object) {
                    return object.get("name");
                }
    
    
                public void setValue(TopMXItem object, String value) {
                }
    
    
                public String getPath() {
                    return "name";
                }
            });
            tree.setExpandOnFilter(true);
            tree.setWidth(300);
            ButtonBar buttonBar = new ButtonBar();
    
    
            buttonBar.add(new TextButton("Expand All", new SelectHandler() {
                public void onSelect(SelectEvent event) {
                    tree.expandAll();
                }
            }));
            buttonBar.add(new TextButton("Collapse All", new SelectHandler() {
                public void onSelect(SelectEvent event) {
                    tree.collapseAll();
                }
            }));
    
    
            buttonBar.setLayoutData(new MarginData(4));
            con.add(filter);
            con.add(buttonBar);
            con.add(tree);
            return con;
        }
    
    
        public void onModuleLoad() {
            RootPanel.get().add(asWidget());
        }
    
    
        private void processFolder(TreeStore<TopMXItem> store, TopMXItem item) {
            for (int i=0;i!=10;++i) {
                TopMXItem child = new TopMXItem(item.get("id") + String.valueOf(i), String.valueOf(i));
                store.add(item, child);
            }
        }
    }

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    10
    Vote Rating
    0
    peterarsentev is on a distinguished road

      0  

    Default


    Can you tell me anything about this problem?

Thread Participants: 1