|
Rank: Advanced Member Groups: Member
Joined: 12/5/2007 Posts: 57
|
Hi,
Couldn't find anything on the forums about this. I have a treeviw with many nodes and levels. Most of the nodes have a url specified so I figure I don't need them to raise a server event and have their RaisesServerEvent property set to false. I only want two of the nodes to raise a server event and have their RaisesServerEvent property set to true. I have the RaisesServerEvent property set to true for the control.
The two nodes are at level 0 and are both collapsed at start up, ideally I would like the event to fire when someone clicks on either of them to expand them. Is this possible? If so, what am I doing wrong as I cannot make it work this way?
Thanks
Gary
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You seem to be doing all the right things. We tried that and it works fine here. Can you provide a test page that demonstrates the problem?
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 12/5/2007 Posts: 57
|
Sure, how would you like to get it?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You can email it to us. Please see your private message for the email address.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You have RaisesServerEvent set to true and NavigateUrl set at the same time. RaisesServerEvent is ignored as soon as NavigateUrl is set. So if you clear NavigateUrl it should work.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 12/5/2007 Posts: 57
|
Thanks for the response. I will give that try, I kust have overlooked that one.
Cheers
|
|
Rank: Advanced Member Groups: Member
Joined: 12/5/2007 Posts: 57
|
Hi,
Well, close but not quite. I made the changes you suggested and when I click on the node the event fires however if I click on the + icon to expand the node it does not. Is there anyway to set this to fire the event when the node is expanded by clicking the + icon?
If not, is there some way to code some client side java script to execute when it is clicked that would allow then cause a server event to be fired and if so how?
Thanks
Gary
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
No. "+" and "-" supposes to expand/collapse node. It does not suppose to raises click event. User can get very annoyed if you keep posting back when all they wanted is to expand a node so that they can see what's beneath it. In theory you can handle the TreeView's ClientSideOnGroupExpand or ClientSideOnGroupCollapsed to trigger anything, even raising a server event, but the event would not have anything to do with the TreeView (thus will not be TreeView ItemClick event). In any case, we do not believe it's a good idea to do that.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 12/5/2007 Posts: 57
|
I agree but had planned to try an figure out a way that one of your callback panel controls would be used thus providing a better user experience. Because of limited space and our desire to avoid any scroll bars within a page I want to trap the event and collapse the slide menu control that is located on top of it.
Is there a way to do that or an example of writing some client side java script that could be used with a callback panel to do this?
Thanks
Gary
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can handle the TreeView's ClientSideOnGroupExpand and ClientSideOnGroupCollapsed event. The first one is fired when a node expand, the second is fired when a node collapses. Inside those event handlers you can do whatever you want with JavaScript ---- it no longer has anything to do with the TreeView. If you wish to trigger a server side inside those handlers, you can either use a CallbackPanel or a ScriptEvent control, or if you wish, to use them both. We would recommend you to start with only using ScriptEvent control and to get that to work first. Once you get that to work, you can add the CallbackPanel if you wish. Adding CallbackPanel at the last step is always easier. To trigger a server event with ScriptEvent control, place a ScriptEvent control in your page and then call something like this in your JavaScript code:
Code: JavaScript
//Trigger ScriptEvent1's server side Command event,
//"anything" is the command name, "whatever" is
//the command argument
eo_TriggerServerEvent("ScriptEvent1", "anything", "whatever");
The first argument is the ID of the ScriptEvent control. The second and the third are up to you. Both are passed to the server side through event arguments of the ScriptEvent's Command event, which is triggered by the above code. Note this is the Command event on the ScriptEvent control ---- it has nothing to do with the TreeView. If you just wish to collapse the slide menu, you do not need to trigger a server event at all. You can call the slide menu's client side JavaScript interface directly. The code will be something like this:
Code: JavaScript
//Get the slide menu object
var slideMenu = eo_GetObject("SlideMenu1");
//Collapse the first item
slideMenu.getTopGroup().getItemByIndex(0).collapseSubMenu();
You may also want to check our client side API reference to see what other methods are available. Hope this helps.
|
|
Rank: Advanced Member Groups: Member
Joined: 12/5/2007 Posts: 57
|
Thanks that was exactly what I was looking for.
|
|