Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Ajax wait indicator in jquery dialogs</h2> <p>I had a similar problem where I wanted to display an ajax wait indicator in jquery dialogs. I come up with an extension for the dialog widget. The extension creates an additional dialog method "busy" which can be called to disable and enable a dialog. This method also blocks all inputs inside the dialog content area.</p> <p><strong>Extension:</strong></p> <pre><code>$.extend($.ui.dialog.prototype, { busy: function (isBusy) { var dialogContent = $(this.element); if (isBusy) { $(dialogContent).find("input, textarea, select").blur(); } if (this.blockedState === isBusy) return; this.blockedState = isBusy; var buttonPane = $(this.uiDialog).find(".ui-dialog-buttonpane"); var buttons = $(buttonPane).find("button"); if (isBusy) { $(buttons).addClass("ui-state-disabled").attr("disabled", "disabled"); $(buttonPane).append($("&lt;div class='ui-dialog-indicator'/&gt;")); $(dialogContent).append($("&lt;div class='ui-dialog-blocked'/&gt;")); } else { buttons.removeClass("ui-state-disabled").removeAttr("disabled"); $(buttonPane).find(".ui-dialog-indicator").remove(); $(dialogContent).find(".ui-dialog-blocked").remove(); } } }); </code></pre> <p><strong>CSS:</strong></p> <pre><code>.ui-dialog-blocked { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; } .ui-dialog-indicator { background: white url(../Images/jquery-ui/ui-anim_basic_16x16.gif) right center no-repeat; width: 16px; height: 16px; } </code></pre> <p><strong>Example:</strong></p> <pre><code>$("#myid").dialog({ modal: true, position: "center", resizable: false, width: "auto", context: this, buttons: { "Add": function () { $(this).dialog("busy", true); $.ajax({ ... complete: function () { $(this).dialog("busy", false); } }, "Close": function () { $(this).dialog("close"); } } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload