What I’m trying to do:
Trying to add_component in FlowPanel from code at a specified index
What I’ve tried and what’s not working:
Code Sample:
self.flow_panel_1.add_component(Label(text="two"),index=2)
self.flow_panel_1.add_component(Label(text="zero"),index=0)
self.flow_panel_1.add_component(Label(text="one"),index=1)
Desired Output
zero one two initial
Produced Output
Clone link:
https://anvil.works/build#clone:LP2I4C4IN55HLTPW=THYDVYQ6TO4RQBXUSWQ3IHNN
Am I doing it wrong or is it a bug?
hugetim
September 26, 2021, 12:42am
2
When you try to insert the first one (“two”) at index 2, there is no index 2. I wonder whether that is causing the issue? If you only use indexes that make sense at the time of insertion, does it work then?
1 Like
self.flow_panel_1.add_component(Label(text="two"),index=0)
self.flow_panel_1.add_component(Label(text="one"),index=0)
self.flow_panel_1.add_component(Label(text="zero"),index=0)
Expected Output: zero one two initial
Actual Output: initial two one zero
1 Like
stucork
September 26, 2021, 1:24pm
4
Thanks for the clone link - the behaviour should work as @hugetim described.
There’s a bug in the implementation, and this should be fixed soon.
2 Likes
stucork
Split this topic
March 7, 2022, 9:38am
6
5 posts were split to a new topic: Working with global variables