[ 5 posts ]

Andy M

  • Username: ajmazing
  • Joined: Wed Jun 27, 2012 7:33 am
  • Posts: 4
  • Offline
  • Profile

TreeView - Disabling expand and collapse on label click

Post Posted: Thu Jun 28, 2012 4:58 am
+0-
Hey guys,

Do any of you know of a way to disable the expansion/collapsing of nodes when the label of a node is clicked? I'd still like to be able to perform other actions, such as a postback or something, but doing this is a little annoying when the nodes are being expanded/collapsed every time they are clicked.

I'd still like to maintain the expand/collapse functionality by clicking on the + icons to the side, however.

Is this even possible? I've tried returning false when the expand/collapse actions are triggered, amongst other things, but this seems to cancel the post-back and prevents the + icons from working.

Cheers!

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: TreeView - Disabling expand and collapse on label click

Post Posted: Thu Jun 28, 2012 10:18 am
+0-
Listen to the click event and return false.

See:

http://developer.yahoo.com/yui/docs/YAH ... clickEvent

Andy M

  • Username: ajmazing
  • Joined: Wed Jun 27, 2012 7:33 am
  • Posts: 4
  • Offline
  • Profile
Tags:

Re: TreeView - Disabling expand and collapse on label click

Post Posted: Thu Jun 28, 2012 12:14 pm
+0-
My understanding of returning false is that it will cancel everything -- I still want to do other things after I click on the node; I just don't want to expand or collapse it when this happens.

When I add a new listener to that action, and make it return false, this makes NOTHING happen when I click the node. I don't want that.

Is that correct, or am I just understanding (and implementing..?) this incorrectly?

Thanks!

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: TreeView - Disabling expand and collapse on label click

Post Posted: Thu Jun 28, 2012 9:27 pm
+0-
There is nothing that prevents you from adding code to do any number of things within the same listener beyond returning false.

That is the whole idea of the click event, to use it for whatever you want done and, finally, return false to prevent the default action which is to toggle.

Andy M

  • Username: ajmazing
  • Joined: Wed Jun 27, 2012 7:33 am
  • Posts: 4
  • Offline
  • Profile
Tags:

Re: TreeView - Disabling expand and collapse on label click

Post Posted: Fri Jun 29, 2012 4:25 am
+0-
Ah, okay, that makes sense!

I managed to get the desired effect now, thanks!
  [ 5 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum