Stump the Panel Topic: Jquery UI Dialog and Web Parts http://www.endusersharepoint.com/STP/ SharePoint QA en Sun, 21 Jun 2009 20:37:48 +0000 CharlieLee on "Jquery UI Dialog and Web Parts" http://www.endusersharepoint.com/STP/topic/jquery-ui-dialog-and-web-parts#post-7725 Wed, 17 Jun 2009 09:41:38 +0000 CharlieLee 7725@http://www.endusersharepoint.com/STP/ <p>Fixed it. Just needed to wrap the initiate code in a<br /> <code>$(document).ready()</code><br /> More info on this can be found at my blog.<br /> <a href="http://f5todebug.blogspot.com/2009/06/best-practice-using-jquery-dialog.html" rel="nofollow">http://f5todebug.blogspot.com/2009/06/best-practice-using-jquery-dialog.html</a> </p> CharlieLee on "Jquery UI Dialog and Web Parts" http://www.endusersharepoint.com/STP/topic/jquery-ui-dialog-and-web-parts#post-7695 Tue, 16 Jun 2009 07:53:18 +0000 CharlieLee 7695@http://www.endusersharepoint.com/STP/ <p>I am having some difficulty getting the Jquery UI dialog widget to play nicely within a web part. I have the following code:</p> <p><code><br /> function initiateModalDialog(selector) {</p> <p> //Initiates the dialog widget<br /> $('#' + selector).dialog({<br /> autoOpen: false,<br /> bgiframe: true,<br /> draggable: false,<br /> width: 600,<br /> resizable: false,<br /> modal: true,<br /> overlay: { opacity: 0.2, background: "black" }<br /> }); </p> <p>}<br /> </code></p> <p>This initiates my dialog and then I use two simple functions to show and hide the dialog.</p> <p><code><br /> //Opens the selected div as a modal dialog<br /> function openModalDialog(selector) { </p> <p> //Opens the dialog<br /> $('#' + selector).dialog('open'); </p> <p> //Appends the dialog to the ASP.Net form to allow postbacks<br /> $('#' + selector).parent().appendTo($("form:first")); </p> <p>} </p> <p>//Closes the selected div dialog<br /> function closeModalDialog(selector) { </p> <p> $('#' + selector).dialog('close'); </p> <p>}<br /> </code></p> <p>As you can see I append the dialog to the asp.net form after it is opened, so that I can handle the controsl within it during postbacks.</p> <p>The problem is that when the initiate code runs it appears to be breaking the DOM somewhere as if I try to edit the web part using the drop down menu I get the following javascript error:</p> <p>Webpage error details</p> <p>User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.30618)<br /> Timestamp: Tue, 16 Jun 2009 11:51:38 UTC</p> <p>Message: 'MSOMenu_WebPartMenu' is undefined<br /> Line: 401<br /> Char: 1<br /> Code: 0<br /> URI: XXXXXXXX</p> <p>Any ideas on how I can effectively initiate the dialog without causing the web part framework to break?</p> <p>Thanks</p> <p>Charlie </p>