[CLOSED] [1.4] Treepanel Filtering issue

  1. #1

    [CLOSED] [1.4] Treepanel Filtering issue

    Hi,

    On the treepanel sample https://examples1.ext.net/#/TreePanel/Advanced/Filter/ , when i type in "xre" on the triggerfield, the XRender gets filtered but its children are not showing up (XRender is expanded).

    Isnt it supposed to be collapsed and when expanded, it should show the Advanced, Basic, UserControl child nodes? What's the work-around for this?

    Thanks much!
    Last edited by Daniil; Aug 07, 2012 at 3:45 AM. Reason: [CLOSED]
  2. #2
    Hi,

    There is just an example of possible filtering.

    Please try the main filtering:
    https://examples1.ext.net

    It expands the nodes you need, but it should be implemented manually, it's not a built-in behavior.

    Please look at the Examples Explorer sources:
    <Ext.NET sources root>/Ext.Net.Examples/resources/main.js
    Search for "filter".
  3. #3
    Hi Daniil,

    Thanks for the tip. Please mark as solved.

    For anyone who may need a solution for this, here's mine, just tweak it to meet your requirements:
    var filterTree = function (el, e) {
                        var tree = TreePanel1,
                    text = this.getRawValue();
    
    
                        tree.clearFilter();
    
    
                        if (Ext.isEmpty(text, false)) {
                            return;
                        }
    
    
                        if (e.getKey() === Ext.EventObject.ESC) {
                            clearFilter();
                        } else {
                            var re = new RegExp(".*" + text + ".*", "i");
    
    
                            tree.filterBy(function (node) {
                                var match = re.test(node.text)
    
    
                                if (!match)
                                    match = checkParent(node, re);
    
    
                                return match;
    
    
    
    
    
    
                            });
                        }
                    };
    
                var clearFilter = function () {
                        var field = triggerFilter,
                    tree = treepanelEvidencePackages;
    
    
                        field.setValue("");
                        tree.clearFilter();
                        tree.getRootNode().collapseChildNodes(true);
                        tree.getRootNode().ensureVisible();
                    };
    
    
                    var checkParent = function (node, re) {
                        var result = false;
                        var parent = node.parentNode;
    
    
                        while (parent != undefined) {
    
    
                            if (re.test(parent.text)) {
    
    
                                result = true;
                                break;
                            }
                            parent = parent.parentNode;
                        };
                        
                        return result;
    
    
                    };
    Regards,
    Marcelo

Similar Threads

  1. [CLOSED] TreePanel Issue
    By sailendra in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 03, 2012, 11:58 AM
  2. [CLOSED] Treepanel Level issue
    By Daly_AF in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 07, 2012, 12:00 PM
  3. Treepanel webservice issue
    By anulall in forum 1.x Help
    Replies: 0
    Last Post: Jun 20, 2011, 7:14 AM
  4. [CLOSED] [1.0] TreePanel SelectedNode Issue
    By ljankowski in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 05, 2010, 6:31 PM
  5. [1.0] TreePanel - PageTreeLoader issue
    By pbsoft in forum 1.x Help
    Replies: 1
    Last Post: Aug 04, 2010, 6:26 PM

Tags for this Thread

Posting Permissions