[CLOSED] TreePanel: prevent loading web resource 1x1 gif with many nodes

Page 1 of 3 123 LastLast
  1. #1

    [CLOSED] TreePanel: prevent loading web resource 1x1 gif with many nodes

    How do I override/prevent and cache the loading of the 1x1 gif for the UI?

    The scenario is this.
    I have a tree that I need to submit all the nodes to the server, but all the nodes won't submit unless they've been expanded at least once. So I need to expand them ALL before submission but that hits the server for this gif hundreds of times and I need to prevent and cache this call.

    Thanks,
    Last edited by Daniil; Apr 11, 2013 at 12:36 PM. Reason: [CLOSED]
  2. #2
    Hello!

    By default, browsers should cache this image. Can you show network log screenshot which shows request for each tree node? And also, can you say browser and server?

    I've tried and browser loads it only once.
  3. #3
    Agreed. It should cache this. I am using a Chrome based browser called IRON (All the chrome, none of the google ;). Any way. The network is showing cache hits and of course there is still a time hit with a cache hit. The problem I think is that I have 1750 nodes and it's just a lot to show. So with that many nodes * levels can equal 3-4 times as many cache hits taking up to 3-4 seconds to render.

    Any ideas on how to submit ALL nodes without having to have them expanded?

    Setting "Animate" to false seemed to help a bit.
    Last edited by jlosi; Apr 05, 2013 at 1:53 PM.
  4. #4
    Quote Originally Posted by jlosi View Post
    Any ideas on how to submit ALL nodes without having to have them expanded?
    Are the nodes static or loaded on expanding? How do you submit the nodes?
  5. #5
    Quote Originally Posted by Daniil View Post
    Are the nodes static or loaded on expanding? How do you submit the nodes?
    The nodes are static. I load them all up at one time.

    To Submit, I call submitNodes on the tree so I can have access the submitted nodes collection.
  6. #6
    Do you really need to expand all the nodes before submitting?

    Please look at the example below. Do not expand the nodes and just press the Submit button. It submits all the nodes.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        private int Count(List<SubmittedNode> children)
        {
            int i = 1;
            foreach (SubmittedNode node in children)
            {
                i += Count(node.Children);
            }
    
            return i;
        }
    
        protected void SubmitNodes(object sender, SubmitEventArgs e)
        {
            X.Msg.Alert("Submit", "You have submitted " + Count(e.RootNode.Children) + " nodes").Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:TreePanel 
                ID="TreePanel1" 
                runat="server" 
                AutoHeight="true" 
                OnSubmit="SubmitNodes">
                <Root>
                    <ext:TreeNode Text="Root (level 0)" Expanded="false">
                        <Nodes>
                            <ext:TreeNode Text="Node1 (level 1)" Expanded="false">
                                <Nodes>
                                    <ext:TreeNode Text="Node1 (level 2)" Expanded="false">
                                        <Nodes>
                                            <ext:TreeNode Text="Node1 (level 3)" />
                                            <ext:TreeNode Text="Node2 (level 3)" />
                                        </Nodes>
                                    </ext:TreeNode>
                                </Nodes>
                            </ext:TreeNode>
                            <ext:TreeNode Text="Node2 (level 1)" Expanded="false">
                                <Nodes>
                                    <ext:TreeNode Text="Node1 (level 2)" Expanded="false">
                                        <Nodes>
                                            <ext:TreeNode Text="Node1 (level 3)" />
                                            <ext:TreeNode Text="Node2 (level 3)" />
                                        </Nodes>
                                    </ext:TreeNode>
                                </Nodes>
                            </ext:TreeNode>
                        </Nodes>
                    </ext:TreeNode>
                </Root>
            </ext:TreePanel>
    
            <ext:Button 
                runat="server" 
                Text="Submit" 
                Handler="function () { TreePanel1.submitNodes(); }" />
        </form>
    </body>
    </html>
  7. #7
    My code operates the same way as what you posted. The only difference is that I'm loading up the nodes async after the tree loads, but I load up all the required nodes (parent/children). If the nodes are collapsed, and I call submitNodes(), then only the nodes that are visible are passed to the server.

    I will try to reproduce this for you and post a sample later. it's 1AM here at the moment.
  8. #8
    Well, something has been changed since this discussion:)

    Quote Originally Posted by jlosi View Post
    Quote Originally Posted by jlosi View Post
    Any ideas on how to submit ALL nodes without having to have them expanded?
    The nodes are static. I load them all up at one time.

    To Submit, I call submitNodes on the tree so I can have access the submitted nodes collection.
    Well, if nodes loads dynamically, then they are absent on client on submitting. So, nothing to submit.

    Expanding, i.e. preloading is the only solution to submit all the nodes.

    Though, I think it might be a problem with the design. Expand/load the nodes to client just to send them back to the server looks inconsistent.
  9. #9
    Quote Originally Posted by Daniil View Post
    Well, something has been changed since this discussion:)



    Well, if nodes loads dynamically, then they are absent on client on submitting. So, nothing to submit.

    Expanding, i.e. preloading is the only solution to submit all the nodes.

    Though, I think it might be a problem with the design. Expand/load the nodes to client just to send them back to the server looks inconsistent.
    There's more that's going on here with the design. The interface allows a user to reorder the nodes and enable/disable nodes. The records need to be displayed in a hierarchy and only certain nodes can be moved.

    The bad design has to do with the awful database we got stuck with. I won't get into that, suffice it to say that we are using the tree as a means to reorder records... so that's why I need to show them all.

    I just wanted to see if I could improve performance a bit.

    Thanks.

    p.s. when you said static nodes, I though you meant 'non-async'
    Last edited by jlosi; Apr 08, 2013 at 1:18 PM. Reason: clarification
  10. #10
    I am afraid that turning down animation is the only thing I can imagine how to improve it.

    The main problem is the fact that each node expand initiates a separate load request.

    Also I still don't quite understand the scenario. I understand the fact that you need to submit a new order of nodes, but if a node is not expanded, it means that a user didn't change the order of its children, isn't?
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 18
    Last Post: Jan 23, 2013, 3:20 PM
  2. Replies: 2
    Last Post: Dec 13, 2012, 4:43 AM
  3. Replies: 4
    Last Post: Nov 03, 2011, 6:46 PM
  4. [CLOSED] Prevent loading of ext-all.css and not load any theme
    By r_honey in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 08, 2011, 8:01 AM
  5. Loading Tree panel nodes from code behind
    By sumesh in forum 1.x Help
    Replies: 2
    Last Post: May 20, 2011, 12:00 PM

Tags for this Thread

Posting Permissions