You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Stefan Moises <be...@gmx.de> on 2012/05/19 13:32:36 UTC

Open WiQuery modal dialog as message / feedback panel

Hi there,

I am trying to open a WiQuery dialog on certain events, e.g. after a row 
of an Inmethod datagrid is edited and saved...
the dialog opens fine when using a link on the page (adding a 
WiQueryEventBehavior to it, as explained in the WiQuery quickstart example).
But if I try to open it on saving an edited row, I get a Javascript error:

*ERROR:*Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: TypeError: Cannot call method 'dialog' of null

This is in my datagrid panel:
             SubmitCancelColumn submitCancelColumn = new SubmitCancelColumn(
                     "esd", new Model("Edit")) {
                 @Override
                 protected void onSubmitted(AjaxRequestTarget target,
                         IModel rowModel, WebMarkupContainer rowComponent) {
                     super.onSubmitted(target, rowModel, rowComponent);
                     try {
                         saveOrUpdateTgl(glid, rowModel.getObject());
                         // try to open dialog in parent page
*findParent(GlTglDetailPage.class).showInfoDialog(getString("save_pos_success"), 
target);*
...
Here is the code of the parent page:
in the Constructor:
         dialog = new Dialog("dialog");
         dialog.setModal(true);
         content = new Label("content", new 
AbstractReadOnlyModel<String>() {
             private static final long serialVersionUID = 1L;
             @Override
             public String getObject() {
                 return contentString;
             }
         });
         content.setOutputMarkupId(true);
         dialog.add(content);
         add(dialog);
...

And a function where I want to open the dialog with the updated content:
     public void showInfoDialog(String msg, AjaxRequestTarget target) {
         contentString = msg;
         target.add(content);
         dialog.open(target);

If I print out the target in the function it contains this:
[AjaxRequestTarget@-830155084 markupIdToComponent [{id1e=[RowItem 
[Component id = 1]], feedback5=[FeedbackPanel [Component id = 
feedback]], content17=[Component id = content]}], prependJavaScript 
[[]], appendJavaScript [[new Effect.Highlight($('feedback5'), { 
startcolor: '#C9DBE7', duration: 4.0 });, new 
Effect.Fade($('feedback5'), { duration: 5.0 });, 
$('#dialog2').dialog('open');]]

So to me it looks ok, it adds
$('#dialog2').dialog('open');
to the target... I am not quite sure what the target really is in this 
case, though?

Does anybody know what the problem may be?
I've found this http://code.google.com/p/wiquery/issues/detail?id=143, 
but I'm not sure this is really related to my problem and if there is a 
real solution to this...

Thanks a lot in advance,
Stefan