SilkUI Modal closing event

Hi, can someone tell how is it possible to catch the event triggered when the SilkUI Modal is closed by clicking outside the modal (that is, by clicking in the parent screen inactive part).

The objective is to run some javascript in the parent screen when that happens.

Hi Luis,

Probably the best way for that is to create an event listener on the modal overlay which will trigger your function.

Let me know it this helps :)

Hi Dinis,

At the time I actually managed to do a workaround by bindind the click event (in the modal background) with the function osAjaxBackend.BindAfterAjaxRequest(...).

However the solution you gave - to trigger the event in the modal js (when the close is being done) - would be a lot better because it would be possible to catch the event independently from how the modal was closed (wich is the point). Can you give me some lights on how can I edit the modal.js that is created automatically by service studio?

Thank you,




Editing the JS of the modal directly is not possible, unless you create a copy of the Block in your app, but you would lose any upgrades from Silk UI.

My suggestion would be to create a new Block with the JavaScript and use that Block inside the modal so it adds the event on it's parent modal.


Thank you very much Dinis ;)