The problem is that when you do |PageTree.prototype = new XULTreeView();|, the XULTreeView constructor initializes PageTree.prototype, and not PageTree. Instead say |PageTree = new XULTreeView();|. If you want to override methods on PageTree, or add new ones, you'll have to do it by modifying PageTree after it is created. This is the way that things happen in venkman-views.js.
Rob.
Daniel Kirsch wrote:
Hi,
I'm using the tree-utils.js from chrome://venkman/content/ to create a tree from JavaScript.
I created a class which inherit from XULTreeView.
function PageTree() { } PageTree.prototype = new XULTreeView();
Now when creating the tree and expanding or collapsing a tree element, the tree doesn't get redrawn. If I force the tree to redraw by moving the window outside the visible area or showing another window in front of it, the new state will be shown correctly.
If I use XULTreeView directly everything works as expected.
Well, I simply don't understand what's causing this and what's the difference between an instance of the XULTreeView class or one subclass implementing XULTreeView.
I would be very happy for an explanation and/or a workaround how to use my own class inheriting from XULTreeView properly.
A complete testcase can be found at: http://www.birgin.de/tree.zip
just the xul file including the scripts can be found at: http://www.birgin.de/tree.xul
The tree at the left indicates the bug while the tree at the right works as expected.
To run tree.xul locally, copy the extracted folder into your chrome directory, add the following new line to your "installed-chrome.txt" file in your chrome directory as well.
content,install,url,resource:/chrome/tree/content/tree/
you may run the example from your commandline: mozilla.exe -chrome chrome://tree/content/tree.xul
Thanks a lot Daniel
