-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I'm using ZK version 5.0.9.
I think I found a bug on tree item render. It happens after updating data and then I invoke the fireEvent with TreeDataEvent.CONTENTS_CHANGED param.
This is a normal tree.
This is a (still normal) tree after changing the child of the first child of root
But then, if I change the child of the other child of root (and it's child and so-on), and then invoke the fireEvent with the TreeDataEvent.CONTENTS_CHANGED,
it renders to be like this
The "Activity Test 2.1" renders as if it is the child of the "Activity Test 1".
The "Activity Test 2.1" is still the child of the "Activity Test 2" in the database, and if I reload the component, it renders normally.
I also notice that if I close the "Activity Test 2" (pay attention on Picture 3 that it's still showing "-" icon) the "Activity Test 2.1" disappears (see Picture 4 below).
The "Activity Test 2" is now showing the "+" icon. And when I re-open the "Activity Test 2", it goes back to the same like Picture 3.
So, my conclusion is that the "Activity Test 2.1" IS still the child of the "Activity Test 2" but it renders as if it is the child of the "Activity Test 1".
And this doesn't happen with the child of the first child of the root. This also doesn't happen with the child of the root.
Does anyone have a workaround for this? Is this bug already fixed in 5.0.10? I heard that it's still not released yet, but if I need to, I will change to 5.0.10.
Update :
this is the implementation of the AbstractTreeModel
http://pastebin.com/aXgHFEZA
and this is the implementation of the TreeitemRenderer
http://pastebin.com/PMCZgxME
Thanks alot.
Hi,
I managed to solve this by NOT removing the previous treerow and replace it with the new one
but ONLY replacing the value of the treerow.
In my TreeitemRenderer there is this code
item.removeChild(item.getTreerow()); item.appendChild(treerow);
I replace it with
List<Treecell> treecells = item.getTreerow().getChildren(); treecells.get(0).setLabel(activity.getActivityName()); treecells.get(1).setLabel(activity.getActivityType().getParamValue()); treecells.get(2).setLabel(formatter.format(activity.getActivityStart())); treecells.get(3).setLabel(formatter.format(activity.getActivityFinish()));
I'm reaching this conclusion because when I commented the part of the code that remove the previous treerow, and only using a setLabel for the Treeitem, I don't get the same error. So, basically it should be about replacing the previous value, not removing the previous treerow and replace it with a new one.
Thanks.
Asked: 2012-01-03 11:33:25 +0800
Seen: 106 times
Last updated: Jan 03 '12