On Thu, Oct 14, 2010 at 06:33, Mustafa Sak <i...@saksys.de> wrote:
> Hi Derrell,
>
>
>
> just now I tried your advise:
>
> You indicated that you passed the modified array. That is incorrect. You do
> not pass the altered array to setData(). Instead, you simply call
> setData(NULL). When it renders the data, it skips nodes that are null:
>
>
>
> // Skip deleted nodes
>
> if (child == null)
>
> {
>
> continue;
>
> }
>
>
>
>
>
> But there is no skipping.
>
>
>
> tree.getDataModel().prune(nodeId, true);
>
> console.log(tree.getDataModel().getData());
>
> tree.getDataModel().setData(null);
>
> console.log(tree.getDataModel().getData());
>
>
>
> Because of the null elements of the array, my sortfunction doesn’t work
> proper. So did I understand you wrong? Is there no way to clear the NULL
> elements?
>
The nulls will still be in the data model, but they will not be rendered.
What are you sorting and why do the nulls affect your sort function? They'd
all sort to the same place, and then be ignored while rendering...???
The nulls can not be removed from a data model. The ordinal position in the
data model array is the handle that identifies a node. If the nulls were
removed, the location in the array would change, causing any saved handles
to now point to different nodes. Each node has a 'children' array which
contains the handle of the nodes which are children of this one. If you were
to remove an element of the array, all of those children handles would be
off by one. That would be bad. The wrong nodes would now be displayed as
children.
If you are doing lots and lots of pruning, you might consider writing a
different data model class that handled references to other nodes
differently, so that deletions could actually remove the element from the
array.
I hope that makes more sense to you now.
Derrell
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel