|
Title: Load easyui-window markup only when needed Post by: snowsnow on November 24, 2014, 11:40:46 AM I have a easyui-window with lots of content. However, the window is rarely needed in my application.
Because of that I would like to load the code <div class=easyui-window>(lots of stuff here)</div> not on page load, but only when the user needs it. How is this best done with easyui? Thanks! :) :) Title: Re: Load easyui-window markup only when needed Post by: jarry on November 24, 2014, 04:49:44 PM Create a closed window and set 'href' property to indicate what content page will be loaded. This content page does not been loaded until the window is opened.
Code: <div id="w" class="easyui-window" title="Basic Window" closed="true" href="content.html" style="width:500px;height:200px;padding:10px;"> Title: Re: Load easyui-window markup only when needed Post by: snowsnow on November 25, 2014, 03:42:10 AM Thanks!!
The html nodes that make up the window are added to the DOM after page load ... so I guess I have to observe events (e. g. 'click') inside the <window> with jQuery's delegate function .on(). Does easyui offer a solution for that? That'd be great. Title: Re: Load easyui-window markup only when needed Post by: jarry on November 25, 2014, 08:21:56 AM Why do you want to listen for the click event on window? If so please try this.
Code: $(function(){Title: Re: Load easyui-window markup only when needed Post by: snowsnow on November 25, 2014, 09:36:35 AM Thanks for the sample code, that's exactly how I do it. I thought there was some easyui specific way of doing this, that is why I asked.
My window contains several buttons the user can click to perform certain tasks, that is why I need a event listener for the window. Title: Re: Load easyui-window markup only when needed Post by: jarry on November 25, 2014, 03:16:55 PM The linkbutton has the built-in 'onClick' event. You can use it to perform the clicking action.
|