tal
tal copied to clipboard
Updating listIndex when inserting a child widget to a List.
Why does the _listIndex
of the items in a List Widget not get updated when using the insertChildWidget
method? This for instance does happen when one removes a child widget from a list.
Is this intended behaviour, or is this a bug? If so, we can implement a (tested) fix for this issue.
Another question that arose when investigating the aforementioned issue is why does the _totalDataItems
property get decremented when one removes a child widget from a list, but does not get incremented when inserting or appending a child widget.
Our use case for this was ordering a list by removing and inserting widgets in a databound list.
Kind regards,
Sander Looijenga 24i
Good questions. I suspect both issues you mention are bugs. It appears that both variables are only really used in list.js's bindProgressIndicator()
, which I don't think we use in any of our current products. Even when we did use it, I assume we never removed or inserted items after the list was rendered.
Does this mean you are using bindProgressIndicator()
and the horizontal progress widget? If this is causing a problem for you then feel free to submit a patch - preferably with unit tests that fail when the bug is still present.
Before you spend too much time, I'll just point out that we now use carousels - the Carousel widget, not the deprecated horizontalcarousel - in preference to lists in our own products. You may find fewer bugs if you use the carousel widget, although I don't believe it interacts with the horizontal progress widget out of the box.
Hope that helps.
We're not using the bindProgressIndicator()
method.
This bug seems messes up the _listIndex
property of a listitem when using data binding and the manually removing and adding a widget (for example you can wind up with two widgets with the same _listIndex
value).
it's quite an edge case, but I think it would be expected that the _totalDataItems
will be increased when using insert/appendChildWidget
and that the _listIndex
values are recalculated when using insertChildWidget
(just as it's now doing when calling removeChildWidget
).
If you agree with our notions that this should be fixed, we'll provide a pull requests + tests for this.
Personally I like using the lists because they provide an interface for simple navigation without a lot of overhead.
Kind regards,
Bas Tuijnman 24i
I agree it should be fixed, although I'm not sure what the effect of the bug is if you're not using bindProgressIndicator()
. Feel free to submit a pull request whenever you're ready! Thanks for your help.
Closing issue due to TAL deprecation .