Popup

This component is used to display a popup, you can add buttons to it and specify js functions for each button. The content of the popup can be filled with the result of an action, or defined in the view.

Basic usage

It can be used by initialising it first and opening it after using js like this:
@Html.Awe().InitPopup(new PopupOpt
{
    Name = "popup1",
    Url = Url.Action("Popup1"),
    Title = "popup title"
})

@Html.Awe().Button().Text("Open Popup").OnClick(Html.Awe().OpenPopup("popup1"))
Note: When there is more Popup helpers declared that have the same
.Name(string)
, they will share the same popup window, so opening one will close the other.

Opening the popup

You can open an initialised popup using the
awe.open
js function, like this:
awe.open('popup1');
and if you need to send additional parameters (like for an edit grid row button), you can do it like this:
awe.open('popup1', { params: { id: 73 }); 
// or
awe.open({ id: 'popup1', params: { id: 73 });

Open popup without prior initialization

The popup can be opened by simply calling
awe.open
without having to initialize it first, example:
awe.open({ content: 'hi' });
Example with all the options:
awe.open({
    id: 'popupAwe', // optional
    setCont: function (sp, o) {
        //console.log(aweUtils.getParams(sp));
        var cont = $('<div style="padding: 0 3em;">Are you sure you want to perform this action?</div>');
        o.scon.html(cont);
    },
    btns: [
        {
            text: 'Yes',
            ok: 1, // add okbtn class
            action: function () {
                $(this).data('api').close();
            }
        },
        {
            text: 'No',
            action: function () {
                $(this).data('api').close();
            }
        }],
    height: 200,
    width: 700,
    title: 'please confirm',
    modal: true,
    //content: 'hello world'
    //top: true,
    //close: function() { console.log('popup closed'); },
    //url: '@Url.Action("Popup1")', // works if setCont and content not set
    //params: { p: 123 }
    //outClickClose: true,
    //popupClass: 'class1',
    //fullscreen: true,
    //dropdown: true
});

Api

Access the api by calling:
var api = $('#popup1').data('api');
api.close(); // close the popup
api.lay(); // lay the popup

PopupOpt

ButtonsButtons
ContentSet the content of the popup
DropdownDrop down the popup from the opener position
FullscreenIf true the popup will fill the browser window
GroupPopups in the same group can't be open at the same time, so opening one will close the other
HeightSet the height of the popup
InlineInline popup
InlTrghtml id of the inline popup container
LoadOnceLoad popup content when it's opened for the first time only (default false)
MaxWidthSet the max width of the popup
ModalModal popups create an overlay below the Popup div but above other page elements
NameGives the popup a name; default name is awesomePopup; when using 2 popups with same name opening one will close the other.
OnCloseJS function to execute on popup close
OutClickCloseClose popup when clicking outside of it
ParameterFuncSet the name of a js function which will return parameters to be sent to the server on each load
ParametersAdditional parameters to send on load
ParentsWhen a parent element changes value the child will reload and get the parent value as a parameter
PopupClassSet a string to be added in the class attribute of the popup element
ShowHeaderShow popup header
TitleTitle of the popup
TopSet popup position top
UrlThe Url from where to load the content of the popup
WidthWidth of the popup



Comments
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our cookie policy and privacy policy .