What exactly does not work?

Sven

On 07/20/2012 08:42 PM, jrochette wrote:
Hi

I want to change the content of a ajaxFallbackDefaultDataTable depending on
the content of a form (think of it as a searchbar functionality). I used to
do that in wicket 1.5.x but i can not seem to make it work in wicket
6.0.0-beta2. Any help would be greatly appreciated. Here is what my code
look like :

The dataTable :

  public SubscriberPage(PageParameters parameters) {
     super(parameters);
     add(new SearchForm("searchForm"));

     List<IColumn&lt;Subscriber, String>> columns = new
ArrayList<IColumn&lt;Subscriber, String>>();
     columns.add(new PropertyColumn<Subscriber, String>(new
Model<String>("Telephone Number"),
                                                        "tn",
                                                        "tn"));
     [...]
     columns.add(new PropertyColumn<Subscriber, String>(new
Model<String>("Initialized MB"),
                                                        "initializedMB"));

     table = new AjaxFallbackDefaultDataTable<Subscriber, String>("table",
                                                                  columns,
subscriberDataProvider,
                                                                  40);
     table.setOutputMarkupId(true);
     add(table);
}

and here is the form :

private class SearchForm extends Form<String> {
     private static final long serialVersionUID = 1L;

     private String tnModel;
     private Label tnLabel = new Label("tnLabel", "Telephone Number :");
     private TextField<String> tn;

     public SearchForm(String id) {
       super(id);
       tn = new TextField<String>("tnTextField", new
PropertyModel<String>(this, "tnModel"));
       tn.setOutputMarkupId(true);
       add(tnLabel);
       add(tn);

       AjaxButton lSearchButton = new AjaxButton("searchButton") {
         private static final long serialVersionUID = 1L;

         @Override
         protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
           SubscriberFilter filter = new SubscriberFilter();
           target.add(table);
           if (!(tn.getValue() == null) && !tn.getValue().isEmpty()) {
             filter.setTn(tn.getValue());
           }
           // giving the new filter to the dataProvider
           subscriberDataProvider.setFilterState(filter);
         }

         @Override
         protected void onError(AjaxRequestTarget target, Form<?> form) {
           // TODO Implement onError(..)
           throw new UnsupportedOperationException("Not yet implemented.");
         }

       };
       lSearchButton.setOutputMarkupId(true);
       this.setDefaultButton(lSearchButton);
       add(lSearchButton);
     }
   }

Regards,
Jonathan Rochette



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Updating-content-of-AjaxFallbackDefaultDataTable-when-submitting-a-form-with-AjaxButton-wicket-6-0-02-tp4650664.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




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to