From: Wolfram Schneider Date: Thu, 10 Jul 2014 10:30:01 +0000 (+0000) Subject: support multiple popup widgets, part of MKWS-235 X-Git-Tag: 1.0.0~389^2~7 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=7f2f5aff2f7ed1b617eac2fabf669a9ed698db5d;p=mkws-moved-to-github.git support multiple popup widgets, part of MKWS-235 --- diff --git a/examples/htdocs/popup.html b/examples/htdocs/popup.html index 18a2d8c..fd96eb5 100644 --- a/examples/htdocs/popup.html +++ b/examples/htdocs/popup.html @@ -1,20 +1,20 @@ - MKWS demo: Reference Universe widget with popup window + MKWS demo: Reference widget with popup window - + - + @@ -35,10 +35,27 @@ - + - - MKWS widgets in a popup window + + + + + + diff --git a/src/mkws-popup.js b/src/mkws-popup.js index f5b0550..48b5059 100644 --- a/src/mkws-popup.js +++ b/src/mkws-popup.js @@ -3,7 +3,6 @@ */ // "use strict"; - $(document).ready(function () { // mkws.registerWidgetType('PopupWindow', function() { var $ = mkws.$; @@ -15,30 +14,33 @@ $(document).ready(function () { return; } - var popup = $(".PopupWindow"); - if (!popup) { - debug("no popup found"); + var popup_window = $(".PopupWindow"); + if (!popup_window) { + debug("no popup found, skip"); return; } else { - debug("found popup windows: " + popup.length); + debug("found popup windows: " + popup_window.length); } - $(popup).each(function (i) { - var width = parseInt(this.attr("popup_width") || "800"); - var height = parseInt(this.attr("popup_height") || "600"); - var autoOpen = parseInt(this.attr("popup_autoOpen") || "0"); + popup_window.each(function (i) { + var that = $(this); + + var width = parseInt(that.attr("popup_width") || "800"); + var height = parseInt(that.attr("popup_height") || "600"); + var autoOpen = parseInt(that.attr("popup_autoOpen") || "0"); + var modal = parseInt(that.attr("popup_modal") || "0"); debug("Popup parameters: width: " + width + ", height: " + height + ", autoOpen: " + autoOpen); - $(this).dialog({ + that.dialog({ closeOnEscape: true, autoOpen: autoOpen, height: height, width: width, - modal: true, + modal: modal ? true : false, resizable: true, buttons: { Cancel: function () { - $(this).dialog("close"); + that.dialog("close"); } }, close: function () {}