[ 4 posts ]

Brian J. Miller

YUI Contributor

  • Offline
  • Profile

Default a node to open?

Post Posted: Thu Feb 03, 2011 9:04 am
+0-
Is there a way (read: a simple way) to have specific nodes default to open? I figure I can possibly loop over the initial data source potentially calling toggle() to open specific nodes after rendering, though I'm not even sure of that.

John Lindal

YUI Contributor

  • Username: jafl
  • Joined: Mon Nov 02, 2009 2:33 pm
  • Posts: 358
  • Location: Los Angeles, CA
  • Twitter: jafl5272
  • GitHub: jafl
  • Gists: jafl
  • Offline
  • Profile

Re: Default a node to open?

Post Posted: Mon Apr 11, 2011 2:12 pm
+0-
Sorry I didn't find this post sooner!

The difficulty is that opening a node requires a request to the datasource to figure out how many children there are. So it is not a synchronous process. For example, to open a child of a child, you have to call my_table.datasource.get('datasource').toggle() three times, and each call must be nested inside the completion function of the previous call.

If all you want to do is open a top-level node, call my_table.datasource.get('datasource').toggle() with the node index (as an array, e.g., [3]).

I will investigate whether or not it is possible to pass the open state in the data.

John Lindal

YUI Contributor

  • Username: jafl
  • Joined: Mon Nov 02, 2009 2:33 pm
  • Posts: 358
  • Location: Los Angeles, CA
  • Twitter: jafl5272
  • GitHub: jafl
  • Gists: jafl
  • Offline
  • Profile

Re: Default a node to open?

Post Posted: Mon Apr 11, 2011 3:43 pm
+0-
I just pushed an update which allows the initial state of openable nodes to be set in the data. Check the updated yuidoc for "openNodeKey".

William Vincent

  • Username: WilliamVincent
  • Joined: Thu May 30, 2013 6:05 pm
  • Posts: 1
  • Offline
  • Profile

Re: Default a node to open?

Post Posted: Thu May 30, 2013 6:10 pm
+0-
Hi John,

Not sure I should reopen this old post but question is the same. I see your notes regarding the openNodeKey as mentioned in your response, but fail to find any mention of this in any documentation. I cannot get it functional. Can you advise if this is still the proper mechanism and perhaps post back a simple sample of same ?

Many thanks

Vince


I just pushed an update which allows the initial state of openable nodes to be set in the data. Check the updated yuidoc for "openNodeKey".
  [ 4 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