manually find and expand all parent nodes of a selected feed in feedTree

because dojo is incapable of doing it itself in a situation where tree
persistence cookie is at initial state, bloody fucking hell
master
Andrew Dolgov 12 years ago
parent 781f789171
commit 2196b517cd

@ -218,7 +218,63 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
return label;
},
expandParentNodes: function(feed, is_cat, list) {
try {
for (var i = 0; i < list.length; i++) {
var id = String(list[i].id);
var item = this._itemNodesMap[id];
if (item) {
item = item[0];
this._expandNode(item);
}
}
} catch (e) {
exception_error("expandParentNodes", e);
}
},
findNodeParentsAndExpandThem: function(feed, is_cat, root, parents) {
// expands all parents of specified feed to properly mark it as active
// my fav thing about frameworks is doing everything myself
try {
var test_id = is_cat ? 'CAT:' + feed : 'FEED:' + feed;
if (!root) {
if (!this.model || !this.model.store) return false;
var items = this.model.store._arrayOfTopLevelItems;
for (var i = 0; i < items.length; i++) {
if (String(items[i].id) == test_id) {
this.expandParentNodes(feed, is_cat, parents);
} else {
this.findNodeParentsAndExpandThem(feed, is_cat, items[i], []);
}
}
} else {
if (root.items) {
parents.push(root);
for (var i = 0; i < root.items.length; i++) {
if (String(root.items[i].id) == test_id) {
this.expandParentNodes(feed, is_cat, parents);
} else {
this.findNodeParentsAndExpandThem(feed, is_cat, root.items[i], parents);
}
}
} else {
if (String(root.id) == test_id) {
this.expandParentNodes(feed, is_cat, parents);
}
}
}
} catch (e) {
exception_error("findNodeParentsAndExpandThem", e);
}
},
selectFeed: function(feed, is_cat) {
this.findNodeParentsAndExpandThem(feed, is_cat, false, false);
if (is_cat)
treeNode = this._itemNodesMap['CAT:' + feed];
else

@ -513,3 +513,5 @@ function decrementFeedCounter(feed, is_cat) {
exception_error("decrement_feed_counter", e);
}
}

Loading…
Cancel
Save