[Editor] Adjusting options before row data is set
[Editor] Adjusting options before row data is set
Is it possible to adjust options before row data is set when edit window ('main') is opened?
What I would like to do is dynamicly build the options before row data is set, so when it is set it will select the correct option.
The first event (initEdit) is already after row data is set.
Simplified use case:
I have a field 'status', which can be 1-10. My status can only go forward, or backwards by 1, so when I edit a row with status=5 I want my options to be 4-10.
When I close the edit window and try to edit a row with status 3, options must be 2-10.
What happens now is that it tries to find value 3 in the old list (4-10) and can't find it, so it won't select it.
I hope that is clear enough.
Replies
Is calling
editor.field('status').update(options);
right before callingeditor.edit(row);
the way to go here?My actual use case has multi level dependencies, and this way I need to have the logic in two places. In the
onclick
right beforeeditor.edit()
and independent()
Is there a specific reason why
set
is called beforedependent()
in form creation?Yes, using the field's
update()
method just after callingedit()
sounds like a good option to me here.The
dependent()
method might not be too useful in this case, as the field is dependent on its own value!It has to be -
dependent()
is triggered by a value change on the field, which happens when the field's value is set.Allan