<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: OnClose Event For Dialog boxes</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on OnClose Event For Dialog boxes</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7695</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7695</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I have added this. You can download it from the site.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 08 Jul 2009 05:37:53 +0300</pubDate>
        </item>
        <item>
        	<title>tropotek on OnClose Event For Dialog boxes</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7640</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7640</guid>
        	        	<description><![CDATA[<p>That&#39;s fantastic news.</p>
<p>I look forward to the 3.5 release.</p>
]]></description>
        	        	<pubDate>Thu, 02 Jul 2009 18:02:14 +0300</pubDate>
        </item>
        <item>
        	<title>tony on OnClose Event For Dialog boxes</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7596</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7596</guid>
        	        	<description><![CDATA[<p>Hello Mick,</p>
<p>First of all thank you very much for your excelent additions and recommendations.</p>
<p>Also the onClose event will be included in the 3.5 release, moreover I will do some tricky condition like this</p>
<p>var hideModal = function (selector,o) {<br />&#160;&#160;&#160; o = jQuery.extend({jqm : true, gb :&#39;&#39;}, o &#124;&#124; {});<br />&#160;&#160;&#160; <em><strong>if(o.onClose) {<br />&#160;&#160;&#160; &#160;&#160; var oncret =&#160; o.onClose(selector, o);</strong></em></p>
<p><em><strong>if (typeof oncret == &#39;boolean&#39;&#160; &#38;&#38; !oncret ) return;<br />&#160;&#160;&#160; }</strong></em><br />&#160;&#160;&#160; if (jQuery.fn.jqm &#38;&#38; o.jqm === true) {<br />&#160;&#160;&#160; &#160;&#160;&#160; jQuery(selector).attr(&#8221;aria-hidden&#8221;,&#8221;true&#8221;).jqmHide();<br />&#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; if(o.gb != &#39;&#39;) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {jQuery(&#8221;.jqgrid-overlay&#8221;,o.gb).hide();} catch (e){}<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; jQuery(selector).hide().attr(&#8221;aria-hidden&#8221;,&#8221;true&#8221;);<br />&#160;&#160;&#160; }<br />};</p>
<p>This way we can control if the dilog should be closed under some condition. If this event does not retun any value the dialog will be closed, but if the event return false the dialog will not be closed.</p>
<p>Regarding the equal id&#39;s in the edit and view form you are abolutley right. WIll make the needed changes.</p>
<p>Thanks again</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Thu, 02 Jul 2009 02:45:38 +0300</pubDate>
        </item>
        <item>
        	<title>tropotek on OnClose Event For Dialog boxes</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7550</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7550</guid>
        	        	<description><![CDATA[<p>I have spent the day trying to get TinyMce to work and found some more things that may be of intrest.</p>
<p>An event like <em>onShow </em>would also help in the base system, Mainly for the view dialog as there is no hooks that I could find to modify the data that is shown.</p>
<p>Using the method outlined in the previous post I added an <em>onShow </em>event after the viewModal() functions are called. This was helpful so I could run jquery on elements in the view dialog.</p>
<p>A major issue I found is, that the view and edit dialog boxes are two seperate dialog instances but they have duplicate id values on the data. This creates havoc when you are looking for a form element by id and receive a td element because you viewed the data before editing the data.</p>
<p>However I added to this line in the view code (around line 870:grid.fomedit.js):</p>
<p style="padding-left: 30px;">$(&#8221;td:eq(&#8221;+(cp-1)+&#8221;)&#8221;,trdata[0]).append(&#8221;&#60;span style=&#39;position:absolute;float:left&#39;&#62;&#8221;+tmp+&#8221;&#60;/span&#62;&#8221;).attr(&#8221;id&#8221;, <strong>&#39;v_&#39; + </strong>nm);</p>
<p>Unfortunatly this stops the elements updating when using the next and previous buttons.</p>
<p>So adding the following into fillData() makes it work:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; function fillData(rowid,obj){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var nm, hc,cnt=0,tmp, opt;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid+&#39; td&#39;,obj.grid.bDiv).each( function(i) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; nm = <strong>&#39;v_&#39; +</strong> obj.p.colModel[i].name;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ...</p>
<p>Just keep in mind it can be bad prictice to have multiple id values in any web app.</p>
</p>
<p>So at the end of it all, to implement TinyMCE I added an array of fields that I want the editor to attach to:</p>
<p>var mceList = [&#39;comment&#39;];</p>
<p>Then in the edit/add options objects I put somthing like this:</p>
<p>{<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; width: 600,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; reloadAfterSubmit: false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; closeAfterEdit: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; afterShowForm: function (form) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery(&#39;#pData, #nData&#39;).hide();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <em><strong>// Initalise MCE fields</strong></em><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (y=0; y &#60; mceList.length; y++) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tinyMCE.execCommand(&#39;mceAddControl&#39;, false, mceList[y]);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; onclickSubmit : function(eparams) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var retarr = {};<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <em><strong>// Grab the MCE editor content for posting</strong></em><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (y=0; y &#60; mceList.length; y++) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (tinyMCE.getInstanceById(mceList[y])) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; eval(&#39;retarr.&#39; + mceList[y] + &#39; = tinyMCE.getInstanceById(mceList[y]).getContent()&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return retarr;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>onClose: function(sel, o) {&#160; // &#60;&#8211; NEW CALL</strong><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <em><strong>// Clean up MCE before hide</strong></em><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (y=0; y &#60; mceList.length; y++) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (tinyMCE.getInstanceById(mceList[y])) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tinyMCE.execCommand(&#39;mceFocus&#39;, false, mceList[y]);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tinyMCE.execCommand(&#39;mceRemoveControl&#39;, false, mceList[y]);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; afterSubmit: function (response, postData) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return [true, &#39;&#39;];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }, // edit options</p>
<p>With these couple of additions, TinyMCE can be inserted without changing any of its base code. And hopefully if the onClose event is added no changes to the grid codebase would be required either.</p>
<p>Hope this info is useful.</p>
<p>Cheers</p>
<p>Mick</p>
]]></description>
        	        	<pubDate>Tue, 30 Jun 2009 07:00:49 +0300</pubDate>
        </item>
        <item>
        	<title>tropotek on OnClose Event For Dialog boxes</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7545</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7545</guid>
        	        	<description><![CDATA[<p>Thanks for the tip Tony, but it didn&#39;t achieve the desired result. To get this to work you would have to add the code to the `<em>afterShowForm</em>` event so the dialog box exists first.</p>
<p>However I have had a play with the source code and it may be something you can add to the project. If we modify the <em>hideModel()</em> function a little like the following code. There could be better parameters passed to <em>onClose </em>if any,&#160; but I will leave that up to you:</p>
<p>var hideModal = function (selector,o) {<br />&#160;&#160;&#160; o = jQuery.extend({jqm : true, gb :&#39;&#39;}, o &#124;&#124; {});<br />&#160;&#160;&#160; <em><strong>if(o.onClose) {<br />&#160;&#160;&#160; &#160;&#160;&#160; o.onClose(selector, o);<br />&#160;&#160;&#160; }</strong></em><br />&#160;&#160;&#160; if (jQuery.fn.jqm &#38;&#38; o.jqm === true) {<br />&#160;&#160;&#160; &#160;&#160;&#160; jQuery(selector).attr(&#8221;aria-hidden&#8221;,&#8221;true&#8221;).jqmHide();<br />&#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; if(o.gb != &#39;&#39;) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {jQuery(&#8221;.jqgrid-overlay&#8221;,o.gb).hide();} catch (e){}<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; jQuery(selector).hide().attr(&#8221;aria-hidden&#8221;,&#8221;true&#8221;);<br />&#160;&#160;&#160; }<br />};</p>
<p>In the <em>grid.formedit.js</em> we can define the <em>onClose </em>functions in the dialog objects:</p>
<p>&#160;&#160;&#160; searchGrid : function (p) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8230;.<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; onInitializeSearch: null,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <em><strong>onClose: null,</strong></em><br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; closeAfterSearch : false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8230;.</p>
<p>&#160;&#160;&#160; editGridRow : function(rowid, p){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8230;.<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; afterclickPgButtons: null,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <em><strong>onClose: null,</strong></em><br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; editData : {},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8230;.</p>
<p>Then on all calls to the <em>hideModel()</em> function we send the <em>onclose </em>function:</p>
<p>&#160;&#160;&#160; hideModal(&#8221;#&#8221;+IDs.themodal,{gb:&#8221;#gbox_&#8221;+gID,jqm:p.jqModal,<em><strong>onClose: p.onClose</strong></em>});</p>
<p>This way you can add the <em>onClose </em>event to an edit/add/view/search dialog box and it will be called whenever someone closes it.</p>
<p>If you can add this to the src files then we have a nice way to implement <em>TinyMCE</em> and I would be more than happy to write a short tutorial on how to implement it.</p>
<p>On another issue I have implemented the <em>ajaxFileUplode </em>as per your suggestions in the forum and I can say it is possible, and works great.</p></p>
]]></description>
        	        	<pubDate>Tue, 30 Jun 2009 02:14:14 +0300</pubDate>
        </item>
        <item>
        	<title>tony on OnClose Event For Dialog boxes</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7529</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7529</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Try</p>
<p>jQuery(".ui-jqdialog-titlebar-close").bind(&#39;click&#39;,function(){</p>
<p>// do something here</p>
<p>// if you use jqModal to close the modal you need</p>
<p>hideModal("#editmod"+gridid, {jqm:true});</p>
<p>// where gridid is your grid id and hideModal is a function from grid common</p>
<p>});</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 29 Jun 2009 03:03:14 +0300</pubDate>
        </item>
        <item>
        	<title>tropotek on OnClose Event For Dialog boxes</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7525</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/onclose-event-for-dialog-boxes#p7525</guid>
        	        	<description><![CDATA[<p>First of all, thanks for a great piece of software&#8230;</p>
<p>After hours of trying I have been unable to find a common onClose event or similar for the dialog boxes (edit/view/add). I am trying to implement TinyMCE and so far I have had promising results.</p>
<p>However if I cancel or close the dialog box I have no event to hide TinyMce before the layer is hidden which in turn crashes TinyMce.</p>
<p>I have used the navGrid option events for initialising and hiding TinyMCE if a full edit/add has taken place, it works fine. But TinyMCE crashes if the textarea element is hidden before it is unregistered with the TinyMCE object.</p>
<p>A good article on the issue can be found at: <a title="TinyMCE initalisation" href="http://blog.mirthlab.com/2008/11/13/dynamically-adding-and-removing-tinymce-instances-to-a-page/" target="_blank"><a href="http://blog.mirthlab.com/2008/" rel="nofollow">http://blog.mirthlab.com/2008/</a>.....to-a-page/</a></p>
<p>Maybe there could be a call for a new event in the navGrid (onHide() or onClose()?</p>
<p>I have tried:</p>
<p style="padding-left: 30px;">//&#160;&#160;&#160; $("#cData, .jqmClose:parent").bind(&#39;click&#39;, function (e) {<br />//&#160;&#160;&#160;&#160;&#160;&#160;&#160; alert(&#39;Hiding Now!&#39;);<br />//&#160;&#160;&#160; });</p>
</p>
<p>Any suggestions would be appreciated.</p>
]]></description>
        	        	<pubDate>Sat, 27 Jun 2009 22:33:29 +0300</pubDate>
        </item>
</channel>
</rss>