Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Are OnNodeClicked and NodeClickedScript mutually exclusive? (Read 2277 times)
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Are OnNodeClicked and NodeClickedScript mutually exclusive?
Jul 17th, 2013 at 4:24pm
Print Post  
Hi,

For the most part, I want to handle the nodeClicked event in Javascript, but on occasion I need to deal with it in code behind.
I can cause a postback using some other techniques, but I just wanted to clarify that the server side event will not fire, if I have NodeClickedScript specified.

Here's what I was hoping would work:

Code (Javascript)
Select All
function onClientNodeClicked(sender, args)
            {
                var tag = args.getNode().getTag();

                switch (tag)
                {
                    case "client":
                        // handle this right here
                        args.set_cancel(true);
                        break;
		    case "server"
			// Don't cancel this request - allow code behind to handle
			args.set_cancel(false);
			break;
		}
} 



Thanks in advance.
Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Are OnNodeClicked and NodeClickedScript mutually exclusive?
Reply #1 - Jul 18th, 2013 at 10:52am
Print Post  
Hi,

Yes, they are mutually exclusive, there's no post-back script generated for nodes if either NodeClickedScript or NodeDoubleClickedScript is set.

You should be able to implement that easily by leaving NodeClickedScript unset, and instead handling the CreatingAreaElement event. You can add an onclick attribute from the CreatingArea event handler only for some nodes, and the control will not generate post-back click handlers for them. The remaining nodes will post back automatically and raise the server side click event.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Are OnNodeClicked and NodeClickedScript mutually exclusive?
Reply #2 - Jul 18th, 2013 at 12:45pm
Print Post  
Good advice as always.
Thanks

Jim
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint