I'm using Wicket 2.0-Snapshot.

After rethinking what I was doing I simplified the whole thing, thinking
that maybe I was complicating matters and that was the reason that the
error was occurring.  But after greatly simplifying both the Java code
and the markup, I still get the same behaviour:  On first click of the
add button the listview updates, but on subsequent clicks I get the
error that the root <ajax-response> element cannot be found.

The onClick method for the add button is getting called every time and
executes, but after the first click nothing happens and the Wicket Ajax
Debug gives the error on the ajax response.  Here is the code and
markup:

public class ParameterContainer extends WebMarkupContainer {
 private List<ParameterType> paramTypes = new
ArrayList<ParameterType>();

 public ParameterContainer(
   MarkupContainer parent, String id, List<ReportParameter> parameters
  )
 {
  super(parent, id);
  setOutputMarkupId(true);
  for (ParameterType param : ParameterType.values()) {
   paramTypes.add(param);
  }
  new ListView(this, "parameter", parameters) {
   @Override
   protected void populateItem(ListItem item) {
    new TextField(item, "name", new PropertyModel(item.getModelObject(),
"name"));
    new TextField(item, "description", new
PropertyModel(item.getModelObject(), "description"));
    new DropDownChoice(item, "parameterType", new
PropertyModel(item.getModelObject(), "parameterType"), paramTypes);
    new TextField(item, "dataType", new
PropertyModel(item.getModelObject(), "dataType"));
   }
  };
  new AjaxFallbackLink(this, "newParameter") {
   @Override
   public void onClick(AjaxRequestTarget target) {
    addNewParameter(target);
   }
  };
 }
 private void addNewParameter(AjaxRequestTarget target) {
  parameters.add(new ReportParameter());
    target.addComponent(parameterList);
 }
}

<div wicket:id="parameterList">
 <table cellpadding="3" width="75%">
  <tr>
   <td align="right">Report Parameters:</td>
   <td>Name</td>
   <td>Description</td>
   <td>Parameter Type</td>
   <td>Data Type</td>
  </tr>
  <tr wicket:id="parameter">
   <td></td>
   <td><input maxlength="50" size="25" type="text"
wicket:id="name"/></td>
   <td><input maxlength="255" size="25" type="text"
wicket:id="description"/></td>
   <td><select wicket:id="parameterType"><option>JasperReport
Item</option><option>Where Clause Item</option></select></td>
   <td><input maxlength="255" size="25" type="text"
wicket:id="dataType"/></td>
  </tr>
  <tr>
   <td><input type="button" wicket:id="newParameter" value="Add New
Parameter"/></td>
  </tr>
 </table>
</div>

Thanks,
Matt.


On Thu, 2007-06-14 at 06:32 +0300, Timo Rantalaiho wrote:
> On Wed, 13 Jun 2007, Matthew R Hanlon wrote:
> > The problem I am having is that the first item that is added works fine,
> > and the item is added to the list.  However, any subsequent adds fail
> > with the following AJAX debug information:
> 
> You might want to
> - log or debug what's happening on your ajax event handlers 
>   on the successful and failed attempts
> - show your java code as well
> 
> Also, which Wicket version are you using?
> 
> - Timo
> 
-- 
Matthew R Hanlon <[EMAIL PROTECTED]>
Alliance Communications Management


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to