On Fri, Jan 29, 2010 at 03:40, Tom Schindl <tom.schi...@bestsolution.at>wrote:
> Hi,
>
> I'm just working on additional libraries [1] for my QxWT-Project and I
> think I hit a bug in the virtual tree. It looks like the first Node in
> the Tree is *always* showing a expand-icon even if there's no child [2].
> Is this a know problem?
>
No, it works as expected. I suspect that you're not specifying that you do
not want the open/close button to be visible all the time. You should call
tree.setAlwaysShowOpenCloseSymbol(false);
Here's an example. The open/close symbol is shown. After you run this in the
playground, then comment out the child= line and rerun it, and you'll see
that the root's open/close symbol has gone away.
// tree
var tree = new qx.ui.treevirtual.TreeVirtual("Tree");
tree.set(
{
width : 400
});
tree.setColumnWidth(0, 400);
// Do not show the open/close symbol if there are no children
tree.setAlwaysShowOpenCloseSymbol(false);
// add the tree to the document
this.getRoot().add(tree,
{
left : 10,
top : 30,
bottom : 30
});
// get the tree data model
var dataModel = tree.getDataModel();
// add the root element
var root = dataModel.addBranch(null, "Root", true);
// add a child element.
// Comment next line out to make the open/close on Root go away
var child = dataModel.addBranch(root, "child", true);
// Tell the tree to refresh using current data in data model
dataModel.setData();
>
> The second thing I'm not sure is how I can *insert* a node at a
> specified position in the tree. Until now I was only able to find a
> method to append entries at the end or move them below a specified
> parent node.
>
> If this feature is not available how hard do you think it is to add such
> an API.
>
That feature is not available, currently. If you look at
qx/ui/treevirtual/SimpleTreeDataModel.js in the method _addNode(), you'll
see at the end of the method it inserts the new node into the parent's
children array by doing parentNode.children.push(nodeId). To do an addAt()
you'd need to either rewrite this method to insert the children at a
specific position in the parent's children list, or provide a method that
moves the just-inserted node within its parent's children list to the
location where you want it.
Derrell
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel