1

How to create custom popup in tridion which will be shown when execute method gets called?

In GUI extension while executing the . _execute method I would like show custom popup modal. Not that browser popup.

I want to create new modal popup and display that when ._execute function gets called. This ._execute function is getting called on one button click.

So that's I am trying to achieve. Please let me know as early as possible if anyone know anything.

5
  • Can you provide more details and your use case? Without many details I can say that GUI extensions is what you need. Commented Sep 19, 2018 at 11:29
  • 1
    Can you also highlight what you've looked at/read/tried? Commented Sep 19, 2018 at 12:32
  • Welcome to Tridion Stack Exchange, @Dipak. In terms of use case, it would indeed help to edit your question to add where you're trying to create such a pop-up. For example, is this for editors or for visitors of your website? Commented Sep 20, 2018 at 8:14
  • In GUI extension while executing the . _execute method I would like show custom popup modal. Commented Sep 20, 2018 at 11:16
  • In GUI extension while executing the . _execute method I would like show custom popup modal. Not that browser popup. I want to create new modal popup and display that when ._execute function gets called. This ._execute function is getting called on one button click. So that's I am trying to achieve. Please let me know as early as possible if anyone know anything. Commented Sep 20, 2018 at 11:19

1 Answer 1

1

To open your own popup, you simply call the createExternalPopup method of the $popupManager class and pass in the URL and a few other parameters.

For example (taken from the command of my open-sourced CountItems Alchemy plug-in):

execute: function (selection)
{
    var p = this.properties;
    var selectedItem = this._getSelectedItem(selection);
    var url = "${ViewsUrl}CountItemsPopup.aspx#selectedItem=" + selectedItem;
    var height = this._getPopupHeight(selectedItem);
    var parameters = "width=432px, height=" + height + "px";
    var args = { popupType: Tridion.Controls.PopupManager.Type.EXTERNAL };

    p.popup = $popupManager.createExternalContentPopup(url, parameters, args);
    $evt.addEventHandler(p.popup, "close", this.getDelegate(this.closePopup));
    p.popup.open();
}

I recommend implementing your popup window as a View (this.addInterface("Tridion.Cme.View");) and to fire events when buttons are clicked (such as fireEvent("close") to close the popup from the calling execute method).

For an example, take a look at the Popup.js file in the CountItems repository. On line 6, it inherits from Tridion.Cme.View and in the close() method it calls fireEvent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.