My favorites | Sign in
Project Home Downloads
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 53: Initially selected node(s)
2 people starred this issue and may be notified of changes. Back to list
Status:  Verified
Owner:  ----
Closed:  Jan 2009


 
Reported by gregory....@lmco.com, Nov 4, 2008
Maybe I'm missing something, but I think it would be good to have a way to
select a given node key (if it exists) upon load. An initalSelection:
option or something would be nice.
Nov 5, 2008
Project Member #1 moo...@wwwendt.de
Maybe a 'selected' attribute would be useful, like the 'expand' attribute for nodes
in the initialization data.

For example loading from a <ul> tag:
    <li data="key: 'node4', selected: true">xxx
or, when loading from an array:
    children: [{title: "xxx", selected: true, ...}, ...]


Summary: Initially selected node(s)
Status: Accepted
Labels: -Type-Defect Type-Enhancement Milestone-Discussion
Nov 5, 2008
#2 gregory....@lmco.com
that would work well, except in the case where there are multiple nodes carrying the
selected attribute. maybe in that case the last one would be chosen?
Nov 6, 2008
Project Member #3 moo...@wwwendt.de
I am thinking about firing 'select' events in the order of occurence, after the
complete tree was loaded. This would mean, so the last one would win.
 issue #15  and  issue #17  would require multi-selects anyway.
The app could handle the select events to update a dependent details view, for example.

This should also work for lazy nodes.
Nov 6, 2008
#4 gregory....@lmco.com
here's how I got it working, if you have any feedback:

at the bottom of the render function, i put:
if(this.tree.tnSelected == this) {
			$(this.span).addClass(this.tree.options.classnames.selected);
		}

and at the bottom of append, i put:

if( data.selected) {
				if( this.tree.tnSelected ) {
					if( this.tree.tnSelected === dtnode )
						return;
					this.tree.tnSelected.unselect();
				}
				this.tree.tnSelected = dtnode;

			}
Nov 30, 2008
Project Member #5 moo...@wwwendt.de
(No comment was entered for this change.)
Labels: -Milestone-Discussion Milestone-Release0.4
Jan 14, 2009
Project Member #6 moo...@wwwendt.de
Use 
  <li class="selected">
to preselect nodes.
Status: Fixed
Jul 17, 2012
Project Member #7 moo...@wwwendt.de
considered verified
Status: Verified

Powered by Google Project Hosting