1 Reply Latest reply on Aug 13, 2018 5:56 AM by Denis_Chorbadzhiyski

    Implement callback function from modal dialog

    savyamk Lurker

      Hello,

         I am implementing a feature on vSphere client 6.7.which requires me to open a modal dialog which takes an input as html page and displays it. I use a function available in WEB_PLATFORM called WEB_PLATFORM.openModalDialog(). It works perfectly fine. When the user closes the window ,I want a callback function in the main window to be called. How to go about doing it? I also want to send few parameters to the modal dialog while opening it. How do I achieve it. ? I referred the vSphere client sdk documentation for 6.7 and found it can be done using latest js api available. But was not able to successfully implement it .I  tried modal.open() but the browser was unable to recognize it and gave null reference.Where can I find the sample code or way to implement?

        • 1. Re:Implement callback function from modal dialog
          Denis_Chorbadzhiyski Hot Shot

          Hi,

           

          We have received feedback about these features (passing data to and from a modal dialog and having a callback function when closing the modal dialog) and we have implemented them in the new set of JS APIs avaialable in vSphere 6.7 and 6.5U2 SDKs.

          In the SDK deliverables, you can find a document - Javascript-API.html which explains the APIs usage and features. Basically, you have to call "window.frameElement.htmlClientSdk.<namespace>.<api>". In your case that would be "window.frameElement.htmlClientSdk.modal.open({configObject})". Using this, you will be able to pass information to your modal dialog and specify a callback function which will be called when the dialog is closed.

          I recommend that you look at our new HTML Sample plug-in available in the SDK deliverable, where we have demonstrated how to use the new JS APIs.

           

          Best Regards,

          Denis