Introduction to dialog() integration.
jQuery UI have a good support for dialogs and windows. Agile Toolkit 4 takes it to the next level. Most importantly it manages to create contents of the boxes on the fly. Let’s review what we have.
This is one of the simplest interfaces to create dialog. Here is how you call it from inside PHP:
of course you can bind it to the buttons etc. Functions takes 4 arguments:
- text for the dialog itself
- function to call when user clicks ok
- options for dialog (such as width, etc – see jQuery UI manual)
System will properly handle if you have multiple dialogs, although one will always be modal. Another issue is when you close nested dialog, key bindings for Esc (and possibly some other keys) are not working. If you know why – please tell me how to fix.
Binding to button’s click:
$button->js(‘click’)->univ()->dialogOK(‘Are you sure?’,'Clicking OK does nothing’);
Very similar concept, but it features 2 buttons. OK will execute action as specified in 3rd argument. Let’s enhance our example to use this dialog type.
$button->js(‘click’)->univ()->dialogOK(‘Are you sure?’,'This will take you to other page’,
univ().dialogURL()Finally if you want to load URL inside that box, here is a way:$button->js('click')->univ()->dialogURL('Page 2', $this->api->getDestinationURL('page2'));
In addition you can also look at:
Once you are inside a dialog, let's say you want to get out and find out which button caused dialog to open. You can do so by:
This will hide the original $button, which caused dialog to open through URL.
This is useful if you want to refresh part of original content after page inside frame added new entries. For example, here is the exmaple:
->js('click')->univ()->dialogURL('Page 2', $this->api->getDestinationURL('page2'));