I have a script in which I need to reset the options of a dropdown element.
When I try to del
or remove
an options index I run into errors.
How do i do this?
I have a script in which I need to reset the options of a dropdown element.
When I try to del
or remove
an options index I run into errors.
How do i do this?
Please show your code. See Wiki - how to post code on this forum.
for op in enumerate(self.props.options[1:]):
self.props.options.remove(op)
self.props.options = []
Modifying a list while iterating is always a problem, whether on a dropdown's options or anywhere else in jython. For major updates to such a list, build a new complete list.
In this particular case, you can probably do:
del self.props.options[1:]
(Untested.)