Create a new Appdialog.js file with the following code
var contexts = {};var Dialogcount = 0;var app = {getdialog:function (obj) {if (obj) {return obj._ _dialog__; } return undefined; }, Close:function (obj) {var thedialog = This.getdialog (obj); if (Thedialog) {var rest = Array.prototype.slice.call (arguments, 1); TheDialog.close.apply (Thedialog, rest); }}, Initoption:function (obj) {var kendowindoption = {actions: ["Pin", "Refresh", "Maximize", "Minimize", "Close"], draggable:true, pinned:true, Height: "450px", modal:t Rue, Resizable:true, title: "Added", Width: "700px"}; if (obj) {if (obj.actions) {kendowindoption.actions = obj.actions; } if (obj.height) {kendowindoption.height = Obj.height; } if (obj.width) {Kendowindoption.width = Obj.width; } if (obj.title) {kendowindoption.title = Obj.title; }} return kendowindoption; }, Showdialog:function (obj) {var dialogid = "Dialog" + dialogcount; var dialogfilter = "#" + dialogID; if ($ (dialogfilter) = = Undefined | | $ (dialogfilter). length = = 0) $ ("Body"). Append (' <div id= ' + dialogID + ' ></div> '); var instance = $ (dialogfilter). Data ("Kendowindow"); if (instance = = undefined) {var kendowindoption = this.initoption (obj); $ (dialogfilter). Kendowindow (kendowindoption); } var DFD = $. Deferred (); Instance = $ (dialogfilter). Data ("Kendowindow"); instance.__dialog__ = {close:function () {dialogcount = dialogCount-1; Delete instance.__dialog__; Instance.close (); $ (dialogfilter). Remove (); var args = arguments; if (args.length = = = 0) {dfd.resolve (); } else if (args.length = = = 1) {dfd.resolve (args[0]); } else {dfd.resolve.apply (DFD, args); } } }; Dialogcount = Dialogcount + 1; Instance.center (); var url = obj.url; Instance.refresh ({url:url}); Instance.open (); return Dfd.promise (); }};
Create a new index.html page
<! DOCTYPE html>New Page2.html Page<! DOCTYPE html>
Click the Open button effect as follows:
Click the Close button
This function is only done in the approximate, need to continue to improve. The promise operation in the Kendo UI is not well designed. It doesn't feel good to use.