SwellJoe
02-05-2007, 01:24 AM
I've got a tree in a left-hand content panel that acts as a menu for the center content panel. I can't seem to convince it to actually open in the center panel, however. It always loads it into the whole page.
Here's what I've been trying to do (where tree is my TreePanel:
tree.on('click', function (node){
if(!node.isLeaf()){
console.info("Not a leaf! " + node);
node.toggle();
} else {
console.info("Got a leaf! " + node);
getEl('right').dom.src = node.findTarget(null, 'a');
}
});
And the first bit (to open parent nodes when clicked) works...but the second bit is never reached (or doesn't seem to be...I can't really tell because it then opens a new page and refreshes the console so any messages that were there disappear).
An odd side note, which may actually be germane to my primary problem: the "click to open" parent node code actually requires a double click to open. So I suspect something else is sucking up the first click...it's built from markup and has a dummy link "#", so the parent node opening might be catching a link handler first. Which I guess might be whats happening in the leaf node case, as well.
So, I guess I'd like to know how to unhook the default click handler for these elements, or some guidance on how to debug something that is loading into a new page...I suspect I could make more sense of it if any of my console logging worked. ;-)
Thanks!
Here's what I've been trying to do (where tree is my TreePanel:
tree.on('click', function (node){
if(!node.isLeaf()){
console.info("Not a leaf! " + node);
node.toggle();
} else {
console.info("Got a leaf! " + node);
getEl('right').dom.src = node.findTarget(null, 'a');
}
});
And the first bit (to open parent nodes when clicked) works...but the second bit is never reached (or doesn't seem to be...I can't really tell because it then opens a new page and refreshes the console so any messages that were there disappear).
An odd side note, which may actually be germane to my primary problem: the "click to open" parent node code actually requires a double click to open. So I suspect something else is sucking up the first click...it's built from markup and has a dummy link "#", so the parent node opening might be catching a link handler first. Which I guess might be whats happening in the leaf node case, as well.
So, I guess I'd like to know how to unhook the default click handler for these elements, or some guidance on how to debug something that is loading into a new page...I suspect I could make more sense of it if any of my console logging worked. ;-)
Thanks!