Welcome Guest Search | Active Topics | Sign In | Register

Treewview item still gets "selected" style when ClientSideOnItemClick function returns fal Options
Dynamic Web
Posted: Friday, December 14, 2007 2:12:59 PM
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
eo_support
Posted: Friday, December 14, 2007 2:25:11 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Bobby,

Try use ClientSideOnItemMouseDown instead of ClientSideOnItemClick. An item is selected on mouse down, not on mouse click.

Thanks
Dynamic Web
Posted: Friday, December 14, 2007 2:30:41 PM
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
Dynamic Web
Posted: Friday, December 14, 2007 3:26:09 PM
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;

}
}
eo_support
Posted: Friday, December 14, 2007 3:32:15 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Cool! Glad you worked out! I believe the latest build (from our download page) supports getSelectedNode on client side TreeView object.
Dynamic Web
Posted: Friday, December 14, 2007 4:16:15 PM
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
eo_support
Posted: Friday, December 14, 2007 5:32:19 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Boddy,

Try selectNode. That function should be there.

Thanks
Dynamic Web
Posted: Friday, December 14, 2007 9:38:38 PM
Rank: Member
Groups: Member

Joined: 10/22/2007
Posts: 18
That did it. Thanks for the help!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.