Hi,
Prior to 7.0, I was able to dynamically add and remove options in a Segmented. I had to play some games though because a Segmented had to always have at least one option. So, I added a “dummy” option when the Segmented was constructed and initially hid the Segmented. Then, as I added options, I’d remove the dummy option and show the Segmented and keep track of how many options there were. Then, when an option was removed, when I hit zero options, I’d add the dummy item back and hide the Segmented. It was all kind of convoluted, but it DID work under 6.7.0 worked.
Now though, under 7.0.0, that is all broken, that code doesn’t work.
But, the good news is it seems like it should be easier now because I can hide the dummy option with hideOption(), so I no longer ever have to hide the Segmented. And, it seems like I don’t need to keep track of anything anymore either as a result since there will always be that one option present, but hidden (and I’m not 100% sure it even needs to be there anymore, but I’m assuming it still does).
But, it’s not working. Check out this snippet:
https://snippet.webix.com/rj7ddlr2
It’s a simple test: click the Add button, then click the Remove button. You’ll get a script error, and that’s the issue. Note that this happens whether I have that dummy option in there or not (you can uncomment it and the call to hide it, and it does it whether that option is present or not, hidden or not).
I can’t figure this out, but as far as I can tell it seems like it might be a Webix bug. Can anyone confirm if it’s a bug or if I’m doing something wrong?
Something definitely has changed in 7.0 since my previous code doesn’t work now, but this simplified code would be better anyway and it SEEMS like it should work, I just can’t tell if it’s a Webix bug or me doing something wrong.
Thanks!