Popups

There are 2 popup components, the
popup
and the
popupForm
. The
popupForm
has the same features as the
popup
except it adds additional form post handling features.

Basic example

aweui.initPopup({
    id: 'popup1',
    //url: 'myurl', // load the popup content from url
    //content: 'hi', // set popup content
    setCont: function (sp, o) {
        o.scon.html('hi');
        // we can run additional js here
    },
    title: 'my popup'
});

aweui.open('popup1');

Open parameters

You can pass parameters to the popup load function, example:
aweui.open('popup1', { params: { p1: 123 } });
and the load function could look like this:
setCont: function (sp, o) {
    var prm = aweUtils.getParams(sp);
    var msg = '<div> p1: ' + prm.p1 + '</div>';
    o.scon.html(msg);
}

PopupForm

It will open a popup has 2 default buttons:
Ok
- will post the form inside the popup
Cancel
- will close the popup When the form inside the popup will be posted (via Ok button or js) the submit will be handled and an ajax request will be posted instead, if the result of the request is a string the content of the popup will be replaced with that string, if it is a json object the
success
function (if defined) will be executed with that object as a parameter, and the popup will be closed.

Properties

id
popup id, used with
awe.open(id)
, when using 2 popups with same name opening one will close the other
setCont
function executed to set the popup content, it can also return a promise that will set the content later
dataFunc
function to get the popup content, it can also return a promise that will return the content later
content
the string content of the popup
url
the url to the action that returns the content
btns
buttons collection
popupClass
set css class for the popup div
fullscreen
if true the popup will fill the browser window
height
popup height
width
popup width; desired width in case of the default awesome popup
maxWidth
popup max width
title
popup title
modal
modal popup
outClickClose
close popup when clicking outside of it
top
make popup open at the top
close
function to execute on popup close
onLoad
function to execute on popup load
loadOnce
load popup content only once (not on each popup open)
parents
set popup parent parameters
parameters
set popup parameters
parameterFunc
js function to get parameters when loading popup content

PopupForm additional properties

success
function to be executed on successful form post
useDefaultButtons
use default ok and cancel buttons, default true
useFormData
use html
FormData
when posting the form, this enables the posting of file uploads via ajax, default false



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 .