WAMS - Detect when Dynamic Select Weblet Response is Returned

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
caseywhite
Posts: 105
Joined: Thu May 26, 2016 1:17 am

WAMS - Detect when Dynamic Select Weblet Response is Returned

Post by caseywhite » Sat Feb 24, 2018 10:40 am

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.

AbelS
Posts: 27
Joined: Wed Nov 16, 2016 1:43 pm
Location: Sydney, Australia
Contact:

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

Post by AbelS » Mon Feb 26, 2018 2:56 pm

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

caseywhite
Posts: 105
Joined: Thu May 26, 2016 1:17 am

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

Post by caseywhite » Tue Feb 27, 2018 3:09 am

Thanks. Will give this a go.

Post Reply