Page 1 of 1

WAMS - Detect when Dynamic Select Weblet Response is Returned

Posted: Sat Feb 24, 2018 10:40 am
by caseywhite
I need to detect when the WAM dynamic select weblet response is returned when monitoring a field for a change. I need to run some Javascript when the dynamic select weblet is populated with the new set of options. It doesn't appear there is a way to know that the response has been returned but if there is a way in jQuery to determine that the <options> have been rebuilt, I am open to using jQuery to detect this. Thanks in advance for any suggestions.

Re: WAMS - Detect when Dynamic Select Weblet Response is Returned

Posted: Mon Feb 26, 2018 2:56 pm
by AbelS
Hi Casey

Try using a DOM mutation observer: https://developer.mozilla.org/en-US/doc ... onObserver

1. For the MutationObserverInit object set the childList and subtree properties to true
2. Set the target node to the <span> that wraps the dynamic select <select> element

You will get multiple notifications as the <option> elements are removed/added. Code your logic to just process one.

PS: In case it is relevant: https://caniuse.com/#feat=mutationobserver

HTH

Re: WAMS - Detect when Dynamic Select Weblet Response is Returned

Posted: Tue Feb 27, 2018 3:09 am
by caseywhite
Thanks. Will give this a go.