|
Rank: Member Groups: Member
Joined: 10/22/2007 Posts: 18
|
I am using a treeview with ClientSideOnItemClick="treeview_itemclick_handler". The code for that function is:
function treeview_itemclick_handler(e, eventInfo) { if (!window.confirm("Are you sure?")) { return false; } }
When I click on a treeview node, the alert comes up fine, and clicking 'Cancel' does stop the postback, but the node I click on does get the "selected" style, so it appears that the selected node has been changed. How can I stop this from happening, so that if the user clicks 'Cancel' the selected node is not changed?
Thanks, Bobby
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Bobby,
Try use ClientSideOnItemMouseDown instead of ClientSideOnItemClick. An item is selected on mouse down, not on mouse click.
Thanks
|
|
Rank: Member Groups: Member
Joined: 10/22/2007 Posts: 18
|
Ok-- I've switched to ClientSideOnItemMouseDown, and now the "click" server event is being raised even before I can address the alert, and the node "drag" begins even if I click "Cancel"-- I'll keep working with it to find the right combination and let you know if I absolutely can't resolve it myself-- thanks for the help!
--Bobby
|
|
Rank: Member Groups: Member
Joined: 10/22/2007 Posts: 18
|
Ok-- I think I know how to handle it but I need to know the selected node client-side.
How can I get the selected node of a treeview client-side?
My plan is to (1) store the selected node in a local js var (2) if the item click is cancelled, set the selected node back to the original selected node. Like:
var TreeView1 = eo_GetObject("<%= TreeView1.ClientID %>"); var selectedNode = ????? HOW DO I GET THIS?
function treeview_itemclick_handler(e, eventInfo) {
if (!window.confirm("Are you sure?")) { eo_GetObject("<%= TreeView1.ClientID %>").SetSelectedNode(selectedNode); return false;
} }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Cool! Glad you worked out! I believe the latest build (from our download page) supports getSelectedNode on client side TreeView object.
|
|
Rank: Member Groups: Member
Joined: 10/22/2007 Posts: 18
|
Got the new version (2.16) and now I am getting an error that the treeview object doesn't support the method setSelectedNode(node, false). Has this method been removed? I can verify that my local var TreeView1 does correctly point to the tree, and that the node var does point to the correct node.
Also, with the new version I am now getting license errors. Do I need to download a new license file or put it somewhere different with this new version?
Thanks, Bobby
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Boddy,
Try selectNode. That function should be there.
Thanks
|
|
Rank: Member Groups: Member
Joined: 10/22/2007 Posts: 18
|
That did it. Thanks for the help!
|
|