Re: jquery ui dialog and ajax component updating
Thanks. Now I got it working. I got a panel that contains an test ajaxlink and a dialog(also in a panel). My problem was that when the outer panel got ajax updated, then the dialogpanel could not find the javascript in the headerpart. And if I added the javascript in pResponse.renderOnDomReadyJavascript I got the multiple dialog divs. This code solves that problem. Thanks for the 'destroy' hint In my dialog panel: @Override public void renderHead(IHeaderResponse pResponse) { pResponse.renderJavascript($('#+Dialog.this.getMarkupId(true)+').dialog('destroy').remove();, null); pResponse.renderOnDomReadyJavascript($(function() {$( '#+Dialog.this.getMarkupId(true)+' ).dialog({autoOpen: false,width:'auto',height:'auto',resizable: false});})); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jquery-ui-dialog-and-ajax-component-updating-tp1857058p3090654.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jquery ui dialog and ajax component updating
Even better IRequestTarget target = RequestCycle.get().getRequestTarget(); if(target instanceof AjaxRequestTarget) { pResponse.renderJavascript($('#+Dialog.this.getMarkupId(true)+').dialog('destroy').remove();, null); } pResponse.renderOnDomReadyJavascript($(function() {$( '# + Dialog.this.getMarkupId(true) + ' ).dialog({autoOpen: false,width:'auto',height:'auto',resizable: false});})); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jquery-ui-dialog-and-ajax-component-updating-tp1857058p3090717.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jquery ui dialog and ajax component updating
On Thu, Dec 16, 2010 at 6:04 AM, jensiator jens.alen...@megasol.se wrote: Even better IRequestTarget target = RequestCycle.get().getRequestTarget(); if(target instanceof AjaxRequestTarget) { The easier way to do this is to say: if (AjaxRequestTarget.get() != null) -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org*
Re: jquery ui dialog and ajax component updating
Did you solve this problem? Im having the same problem. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jquery-ui-dialog-and-ajax-component-updating-tp1857058p3085030.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jquery ui dialog and ajax component updating
Hi, The jQuery UI Dialog (and the others dialogs too) has this comportement (adding elements at the end of the body) to position the dialogs and for the modal approach. So, when you refresh the dialog, you recreate the instance and so regenerate the HTML. You have to destroy properly your dialog with the call of destroy dialog method and with the call of remove(). I think you must do into the Ajax transaction: target.preprendJavascript($('#myDialog').dialog('destroy').remove();); Regards Julien Roche On Mon, Dec 13, 2010 at 8:44 AM, jensiator jens.alen...@megasol.se wrote: Did you solve this problem? Im having the same problem. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jquery-ui-dialog-and-ajax-component-updating-tp1857058p3085030.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
jquery ui dialog and ajax component updating
Hi, I'm not sure if this is a jquery or wicket problem I'm having. I am using wicket ajax to update (replace) a panel component with a link AjaxLink link = new AjaxLink(link) { public void onClick(AjaxRequestTarget target) { summaryDialog.displaySummary(my summary, target); } }; that when clicked will display the summary dialog that contains a Jquery dialog component I created called SummaryDialog that looks like this: wicket:panel script type=text/javascript $.ui.dialog.defaults.bgiframe = true; $(function() { $(#summaryDialog).dialog({ draggable: true, resizable: false, autoOpen: false, height: 400, width: 800 }).toggle(); }); /script div id=summaryDialog title=Summary span wicket:id=label/span /div /wicket:panel and the java code is simply: public class SummaryDialog extends Panel { Label label; ModelString labelModel = new ModelString(); public SummaryDialog(String id) { super(id); label = new Label(label, labelModel); label.setVisible(false); label.setOutputMarkupId(true); label.setOutputMarkupPlaceholderTag(true); add(label); } public void displaySummary(String summary, AjaxRequestTarget target) { label.setVisible(true); labelModel.setObject(summary); target.addComponent(label); target.appendJavascript($(\#summaryDialog\).dialog('open');); target.appendJavascript($(\#summaryDialog\).dialog('option', 'title', ' + summary+ Summary');); } It all works fine and I notice that at the bottom of the generated HTML, Jquery has added this to the DOM: div aria-labelledby=ui-dialog-title-summaryDialog role=dialog tabindex=-1 class=ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable style=overflow: hidden; display: none; position: absolute; z-index: 1000; outline-color: -moz-use-text-color; outline-style: none; outline-width: 0px;div style=-moz-user-select: none; unselectable=on class=ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfixspan style=-moz-user-select: none; unselectable=on id=ui-dialog-title-summaryDialog class=ui-dialog-titleMy summary Summary/spana style=-moz-user-select: none; unselectable=on role=button class=ui-dialog-titlebar-close ui-corner-all href=#span style=-moz-user-select: none; unselectable=on class=ui-icon ui-icon-closethickclose/span/a/divdiv class=ui-dialog-content ui-widget-content id=summaryDialog span id=label1e2My Summary/span /div/div The problem is when I do something that updates the original panel in Ajax, it never removes the generated DOM so it results in two of these div aria-labelledby id=summaryDialog span id=label1e2My Summary/span /div/div div aria-labelledby ... id=summaryDialog span id=label1e2My New Summary/span /div/div which causes it to no longer work since there are two elements with the same id in the generated DOM. Has anyone encountered anything like this before? I could change my AjaxLinks to normal Link to perform a whole page refresh to get rid of jquery's generated DOM but I'd rather not if I could find a workaround. Thanks, Jason - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org