| Issue 53: | Initially selected node(s) | |
| 2 people starred this issue and may be notified of changes. | Back to list |
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
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
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
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
(No comment was entered for this change.)
Labels:
-Milestone-Discussion Milestone-Release0.4
Jan 14, 2009
Use <li class="selected"> to preselect nodes.
Status:
Fixed
Jul 17, 2012
considered verified
Status:
Verified
|
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, ...}, ...]Status: Accepted
Labels: -Type-Defect Type-Enhancement Milestone-Discussion