This is a migrated thread and some comments may be shown as answers.

Expand problem

5 Answers 131 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
HAG
Top achievements
Rank 2
HAG asked on 19 Feb 2009, 10:39 AM
hi,

i got a problem with expanding a node.

I am fireing the onclicknode event by javascript node.select()

    function selectNode(text, TreeID) 
    { 
        var treeView = $find(TreeID); 
 
        var node = treeView.findNodeByText(text); 
         
        if (node != null
        {         
            node.select();         
        } 
 
    } 

In my serverside on click event i fire the Tree_NodeExpand event to add the childnodes to the selectednode and the i expand the node.
        protected void Tree_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) 
        { 
             
            TreeNode_Click(sender, e); 
            Tree_NodeExpand(sender, e); 
 
 
            e.Node.ExpandChildNodes(); 
            e.Node.Expanded = true
            //e.Node.Toggle(); 
                   
        } 

The node is expanded now, but the expandimage is the collapsed image and the treeview thinks the node is collapsed, so i have to click twice on the collapseimage, to get the expandimage

why does the treeview thinks the node is collapsed?

Thanks for your help

5 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 20 Feb 2009, 07:58 AM
Hello HAG,

The node will have the plus sign image if its ExpandMode is not set to ClientSide. You need to manually expand the node or call the javascript expand() method in order to change the plus sign.

You might find this article helpful: Troubleshooting > Expanding Nodes

Kind regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
chp
Top achievements
Rank 1
answered on 20 Feb 2009, 11:47 AM
ok now i expand the node by javascript.
    function selectNode(text, TreeID) 
    { 
        var treeView = $find(TreeID); 
 
        var node = treeView.findNodeByText(text); 
         
        if (node != null
        {    
            node.expand();     
            node.select(); 
                 
        } 
 
    } 
the tree expand but after one second it collapses. And sometimes, if i try to expand i am getting following  error:
Benutzer-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Zeitstempel: Fri, 20 Feb 2009 11:45:54 UTC


Meldung: 'this.get_element()' ist Null oder kein Objekt
Zeile: 9917
Zeichen: 1
Code: 0
URI: http://localhost/Webgui21/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_ScriptManager_HiddenField&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d1.0.61025.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3ade%3a1f0f78f9-0731-4ae9-b308-56936732ccb8%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2008.3.1314.20%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3ade%3a40af2a53-a50b-4848-aa77-958f331424d9%3a16e4e7cd%3a19620875%3a1e771326%3aaa288e2d%3af7645509%3ae524c98b%3a874f8ea2%3a33108d14%3abd8f85e4


0
Veselin Vasilev
Telerik team
answered on 20 Feb 2009, 01:24 PM
Hello chp,

This might occur because when you call the expand() method - a callback is made to the server. Before it finishes the select() method fires the NodeClick server event.

You need to do the following: call only the node.expand() method. Then subscribe to the OnClientNodePopulated event and invoke the node.select() method there.

I hope this helps.

All the best,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
chp
Top achievements
Rank 1
answered on 23 Feb 2009, 09:51 AM
ok i solved the problem by setting the expandmode to serverside, but now i got another problem with the safari and chrome browsers:

I can only expand nodes with safari and chrome, which are renderd in html. Nodes which has been loaded on demand by expanding the parent node, are not be able to expand. With IE7, IE8, Firefox and Opera it works fine.
0
Veselin Vasilev
Telerik team
answered on 26 Feb 2009, 09:40 AM
Hi chp,

I could not reproduce the problem in our online demos, can you?

You can also open a support ticket and attach a simple running project there so we can reproduce the problem locally.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
HAG
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
chp
Top achievements
Rank 1
Share this question
or