Closed DominikGrebien closed 5 years ago
I don't know why, but it looks like a ItemRenderer
generated via markup somehow looses its _children
.
Hmmm, this is a good one... seems ive broke something somehow. :/
Ok, this was an oversight with cloneComponent not working as it should (or as it used to before the macro refactor)... when you get a moment, can you retest, and close if its working?
Thanks, Ian
Hi Ian, i have tested it and there is another problem.
With the normal itemrenderer in the xml the 100% in the hbox are ignored and with the basicitemrenderer is a second button that should not be there. In this screenshot is the itemrenderer on the left side and the basicitmerenderer on the right.
The new xml is this:
<?xml version="1.0" encoding="utf-8"?>
<vbox width="100%" height="100%">
<hbox height="5%" />
<hbox height="30%" width="30%">
<hbox height="20%" />
<listview id="lv1" width="100%" height="90%">
<itemrenderer>
<hbox width="100%" height="100%" id="myElement">
<hbox width="100%">
<spacer id="spacer" width="10%" height="100%" hidden="true" />
<label id="value1" />
<button id="button1" hidden="false" />
</hbox>
</hbox>
</itemrenderer>
<data>
<item value1="test1" />
<item value1="test2" />
<item value1="test3" />
</data>
</listview>
<listview id="lv2" width="100%" height="90%">
<basicitemrenderer>
<hbox width="100%" height="100%" id="myElement">
<hbox width="100%">
<spacer id="spacer" width="10%" height="100%" hidden="true" />
<label id="value2" />
<button id="button2" hidden="false" />
</hbox>
</hbox>
</basicitemrenderer>
<data>
<item value2="test1" />
<item value2="test2" />
<item value2="test3" />
</data>
</listview>
</hbox>
</vbox>
In this case i only changed the xml.
Cheers, Dominik
what if you use "contentWidth=100%" on the listview?
Also, the itemrenderer would also need to be 100%, the reason BasicItemRenderer doesnt need it is because it does that automatically
If the itemrenderer is set to 100% width nothing changes and if i use "contentWidth=100%" on the listview the whole listview is only 2px wide. The same thing happens if the itemrenderer is set to 100% and "contentWidth=100%" on the listview.
The small line on the left ist lv1.
yeah, something is defo wrong:
<listview id="lv1" height="500" width="500" contentWidth="100%">
<itemrenderer width="100%">
<hbox width="100%" id="myElement">
<hbox width="100%">
<label width="100%" id="value1" />
<button width="100%" id="button1" text="Button" />
</hbox>
</hbox>
</itemrenderer>
<data>
<item value1="test1" />
<item value1="test2" />
<item value1="test3" />
</data>
</listview>
That doesnt work either - ill check it out
Ok, i think thats working... Can you close if its working for you?
Cheers, Ian
fyi, your "height=100%" in the item renderer breaks things (because you dont have them on parent items), though im not sure thats what you were trying to do in the first place, anyway, heres a revised version of your sample:
<listview id="lv1" width="100%" height="90%">
<itemrenderer width="100%">
<hbox width="100%" id="myElement">
<hbox width="100%">
<spacer id="spacer" width="10%" hidden="true" />
<label width="100%" id="value1" verticalAlign="center" />
<button id="button1" text="Bob" hidden="false" disabled="true" />
</hbox>
</hbox>
</itemrenderer>
<data>
<item value1="Test 1" button1="Action 1" />
<item value1="Test 2" button1="Action 2" />
<item value1="Test 3" button1="Action 3" />
</data>
</listview>
Yes not it works thanks for the help.
Cheers, Domi
Expected Behavior
I wanted to use the itemrenderer in the xml file to use it as a structure for the items. Used was the html5 backend.
Current Behavior
The problem is that the listview is correct without a itemrenderer and if the itemrenderer is set the items have the size 10 to 10 px and have no more content.
Steps to Reproduce (for bugs)
Screenshot
The left listview is without the itemrenderer and the right one with the itemrenderer
Test app / minimal test case
Main.hx is this:
Xml is this:
Your Environment