[CLOSED] TreePanel, AjaxProxy and "local" node filtering introduces a stack overflow when applying node filtering

  1. #1

    [CLOSED] TreePanel, AjaxProxy and "local" node filtering introduces a stack overflow when applying node filtering

    Hi,

    I need to have a TreePanel with dynamic node loading. However we also need to apply a local node filter (I mean allow the user to insert a text and filter the nodes by this text).

    It appears that when nodes are dynamically loaded and a filter is applied client-side, expanding a child node (that requires a callback) introduces a stack overflow when trying to apply the filter to the resulting nodes.

    Looking at the details is seems that when the store is preparing to read the nodes it tries to serialize into json the "Filter" object already set on the store (locally) generating a loop.

    This is the code required to configure the tree:

    <ext:TreePanel ID="MyTreePanel" runat="server">
                        <TopBar>
                            <ext:Toolbar runat="server">
                                <Items>
                                    <ext:TextField ID="TextField1" runat="server">
                                        <Listeners>
                                            <Change Buffer="500" Handler="filterTree(this);" />
                                        </Listeners>
                                    </ext:TextField>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <Root>
                            <ext:Node NodeID="Root" Expanded="true" Icon="Accept" />
                        </Root>
                        <Store>
                            <ext:TreeStore ID="TreeStore1" runat="server" AutoLoad="false" RemoteFilter="false" RemoteSort="false" FilterOnLoad="false">
                                <Model>
                                    <ext:Model ID="Model1" runat="server">
                                        <Fields>
                                            <ext:ModelField Name="field" Type="String" />
                                            <ext:ModelField Name="description" Type="String" />
                                            <ext:ModelField Name="entity" Type="String" />
                                            <ext:ModelField Name="config" Type="Object" IsComplex="true" />
                                            <ext:ModelField Name="controlConfig" Type="Object" IsComplex="true" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                                <Proxy>
                                    <ext:AjaxProxy Url='<%# Url.Action("MyAction", "MyController")%>' AutoDataBind="true">
                                        <ActionMethods Read="POST"></ActionMethods>
                                        <Reader>
                                            <ext:JsonReader RootProperty="data">
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:AjaxProxy>
                                </Proxy>
                            </ext:TreeStore>
                        </Store>
                    </ext:TreePanel>
    And this is the script to apply the filter to the tree:

      <script>
            var filterTree = function (textField) {
                var text = textField.getValue();
                var tree = textField.up('treepanel');
                var re = new RegExp(".*" + text + ".*", "i");
    
                tree.getStore().filterBy(function (node) {
                    var visible = re ? re.test(node.data.text) : true;
                    return visible;
                });
            };
        </script>

    Chrome gives the following error "Uncaught RangeError: Maximum call stak size exceeded"

    Thank you for help,
    Last edited by Daniil; Feb 25, 2015 at 9:24 AM. Reason: [CLOSED]
  2. #2
    Hello, @adrianot!

    Can you provide also a method stub for the MyAction returning say, a set with some constant values?

    I think this is all that remains for us to be able to run tour example at our side.

    It is important the method stub returns enough amount to reproduce the stack overflow side effect.

    If in doubt, please refer to these two posts:
    - Forum Guidelines For Posting New Topics
    - More information required
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] TreePanel - cannot append "after" expanded last node
    By jwf in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 24, 2013, 4:08 AM
  2. Replies: 1
    Last Post: Oct 05, 2012, 11:56 AM
  3. [CLOSED] Stack overflow on click of Tree node
    By Aparna_B in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 31, 2011, 8:50 AM
  4. Adding a tree node using "Mode=Remote"
    By mattwoberts in forum 1.x Help
    Replies: 2
    Last Post: Jan 07, 2011, 3:10 PM

Posting Permissions