release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Search | Go
Wiki > System > JQueryPlugin > JQueryUIDialog

JQueryUIDialog

Summary

Homepage: http://docs.jquery.com/UI/Dialog
Author(s): see http://jqueryui.com/about
Version: 1.8.16

A dialog is a floating window that contains a title bar and a content area. The dialog window can be moved, resized and closed with the 'x' icon by default.

If the content length exceeds the maximum height, a scrollbar will automatically appear.

A bottom button bar and semi-transparent modal overlay layer are common options that can be added.

A call to $(foo).dialog() will initialize a dialog instance and will auto-open the dialog by default. If you want to reuse a dialog, the easiest way is to disable the "auto-open" option with: $(foo).dialog({ autoOpen: false }) and open it with $(foo).dialog('open'). To close it, use $(foo).dialog('close').

Usage

To load the library into the current wiki page, add this somewhere on the page:

%JQREQUIRE{"ui::dialog"}%

This will initialized the following css classes to build the dialog widgets:

  • jqUIDialog: dialog definition
  • jqUIDialogLink: anchor pointing to a dialog
  • jqUIDialogButton: buttons to be added to the dialog

Dialogs can be created inline or loaded on demand. The basic skeleton of a dialog definition looks like

<div class="jqUIDialog" id="mydialog" title="Here's the title of the dialog" >

  Here goes the content.

  ...

  <a class="jqUIDialogButton jqUIDialogClose {icon:'ui-icon-circle-check'}">%MAKETEXT{"Ok"}%</a>
  <a class="jqUIDialogButton jqUIDialogClose {icon:'ui-icon-cancel'}">%MAKETEXT{"Cancel"}%</a>
</div>

... which is activated by something like this:

<a href="#mydialog" class="jqDialogLink">Open Dialog</a>

A dialog can also be opened using JavaScript:

jQuery("#mydialog").dialog("open");

To load a dialog asynchronously use a fully quallified hyperref as in

<a href="http://...." class="jqDialogLink">Open Dialog</a>

This will fetch the content of the dialog from the given url and add it to the page before opening it. Once the dialog has been loaded it will be cached as part of the current page unless the cache option to the jqDialogLink has been disabled:

<a href="http://...." class="jqDialogLink {cache:false}">Open Dialog</a>

In this case the dialog will alwas be fetched again from the backend using the given url.

Button Click Actions

When the button is clicked:
  • If the <a> element has the jqUIDialogClose class, then the dialog box will close.
  • If the <a> element has the jqUIDialogSubmit class, then a form defined in the dialog box will be submitted.
  • If the <a> element has an href attribute, then the specified page will be loaded.

Examples

Dialog defined inline

Open Dialog

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Ok Cancel

Dialog fetched asynchronously

Open Dialog

Open Dialog (no cache)

%STARTSECTION{"dialog"}%
<div title="From Ajax call" class="jqUIDialog { modal:true, resizable:true, draggable:true, height:300, width:600}">
  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
  et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
  ex ea commodo consequat.
  <a class="jqUIDialogButton jqUIDialogClose {icon:'ui-icon-circle-check'}">%MAKETEXT{"Ok"}%</a>
  <a class="jqUIDialogButton jqUIDialogClose {icon:'ui-icon-cancel'}">%MAKETEXT{"Cancel"}%</a>
</div>
%ENDSECTION{"dialog"}%

See http://jqueryui.com/demos/dialog/ for more demos.
r1 - 31 Oct 2011 - 18:06:02 - ProjectContributor

Parents: JQueryPlugin
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback