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

Client side code "click"

5 Answers 182 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 19 May 2008, 11:01 AM
Hello,

We need to simulate node click event on client side. We tried to use client side select() method, but this method does not cause postback, like expand() method for example. 

Is there client side method that equivalent to user click action? Or may be there is a workaround for the problem?

Regards,
Olga

5 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 19 May 2008, 01:21 PM
Hi Mushon Nachmias,

Please try using the select function instead, as it will do a postback as required.

Here you can read more about it.

Best wishes,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mark
Top achievements
Rank 1
answered on 19 May 2008, 01:58 PM
Hi Simon,

Instead of what?
select() method does not cause postback, as I wrote in my first post.

Thanks
0
Mark
Top achievements
Rank 1
answered on 19 May 2008, 02:20 PM
Hi Simon,

I have found the following in Telerik's documentation:

Selects or unselects a Node based on the boolean parameter.

If selecting a Node with a mouse does postback, calling the set_selected(true) function will select the Node but will NOT do postback.

Regards,
Olga

0
Simon
Telerik team
answered on 22 May 2008, 09:45 AM
Hello Mushon Nachmias,

The select() function selects a Node but a postback will occur only if you had handled the OnNodeClick server-side event of the RadTreeView; otherwise a postback will not occur although the Node will get selected on the client.

I hope this helps.

All the best,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Eric
Top achievements
Rank 2
answered on 07 Jul 2011, 03:06 AM
A quick addendum to the replies posted here.

I had a need to trigger the client side "click" event of a tree node programmatically in response to a user initiated click of a context menu item. To accomplish this using the client API you can do something like the following:

 

function ContextMenu_onClientMenuItemClicking(sender, e){
    e.get_node().get_textElement().click();
}

Simple, but effective. I have only tested this in IE9, but I believe it should work in most browsers. Hope this helps someone else.
Tags
TreeView
Asked by
Mark
Top achievements
Rank 1
Answers by
Simon
Telerik team
Mark
Top achievements
Rank 1
Eric
Top achievements
Rank 2
Share this question
or