Dropdownlist defaultvalue showed up in modal but not triggering the optionchange event

hi therer,

here is my problem:
in the table, i selected the row, passed the selectedrow object to the modal, in the modal, it gets populated in the dropdownlist as i set the defaultvalue, but the dropdownlist in the modal has the optionchange event which should trigger another query ,but it seemed it never fired until i manually changed the dropdownlist option.

I’ve searched all the commuity for th similar situation, but end up in no answer.

Is there any workaroudn for my case?

Thanks in advance !

Hey @gaoxia! Welcome to the appsmith community :rocket:

So, for starters all the events are only triggered when a user takes a direct action against a widget. In this case as the default value was changed programmatically and not manually, the event didn’t trigger.

Now, the workaround, you have a couple of options -

  1. Either you run the query right after you set the default value
  2. If you only want the query to run if the modal is going to open, then you should trigger it from where you are opening the modal.

That lights me up from the darkness, I paste the code sample here in case new starts like me spent too much time on working around this situation !

in the table rowselectd event,

{{showModal(‘modal_upd_xxx’)
.then(()=> query_upd_1.run())
.then(()=> query_upd_2.run())
.then(()=> query_upd_3.run())

}}