Hello,

I'm trying do display a simple Data Table with a filter on it.
I had a look at the wicket-phonebook example because what I have to do is
really similar to that example.
So I will refer to the code of this example to describe my problem.

The thing is I want to have some filter on the table that would add a
criteria on a status column (not present in the wicket-phonebook example).
This status would be an Integer and I would like to dispay a checkGroup as
filter on this status!

I don't really understand how the page should reload keeping the filter
status (meaning the checked checkboxes) and refreshing the table with the
status criteria.
(NB I don't want to use Ajax here)
Do I have to Implement a load method in my DetachebleContactModel?

I succeeded linking the criteria to my query but don't succeed to refresh
the page correctly.

Can somebody help me with some clues or code example?

I putted some of my code here...
The rest is really base on the wicket-phonebook example

I have seen a similar question in the "Filterable ListViews" thread but
don't really understand how to adapt it in the phonebook example.

Thanks a lot,
Ox



public class ListContactPage extends BasePage {

        ...

        public ListContactPage(List statuses) {
                
                add(new InputForm("inputForm"));
                ...
                

                RequestDataProvider dataProvider = new ConatctDataProvider(
                                getContactDao(), statuses);

                DefaultDataTable table = new DefaultDataTable("requestTable", 
Arrays
                                .asList(columns), dataProvider, 15);

                // I don't use it
                // ... addTopToolbar(new FilterToolbar(...
                add(table);
                ...
        
        }
        
        
         private class InputForm extends Form {
 

                public InputForm(String name)
                {
                    super(name, new CompoundPropertyModel(new 
FormInputModel()));
        
                    CheckGroup statusChecks = new 
CheckGroup("statusCheckGroup");
                    add(statusChecks);
                    ListView statusChecksList = new ListView("statuses",
ContactUtil.getStatusCodes())
                    {
                        protected void populateItem(ListItem item)
                        {
                            item.add(new Check("scheck", item.getModel()));
                            item.add(new Label("status",
item.getModelObjectAsString()));
                        };
                    };
                    statusChecks.add(statusChecksList);
                
                    ...
                 
                }
                
                public void onSubmit(){
                        info("Search model " + getModelObject());
            
                        //Do I have to set a ResponsePage here? Or will it 
automatically remains
and reload the current page
                }
            
        }
        
        ...
}               


public class ListContactPage extends BasePage {

        ...

        public ListContactPage(List statuses) {
                
                add(new InputForm("inputForm"));
                ...
                

                RequestDataProvider dataProvider = new ConatctDataProvider(
                                getContactDao(), statuses);

                DefaultDataTable table = new DefaultDataTable("requestTable", 
Arrays
                                .asList(columns), dataProvider, 15);

                // I don't use it
                // ... addTopToolbar(new FilterToolbar(...
                add(table);
                ...
        
        }
        
        
         private class InputForm extends Form {
 

                public InputForm(String name)
                {
                    super(name, new CompoundPropertyModel(new 
FormInputModel()));
        
                    CheckGroup statusChecks = new 
CheckGroup("statusCheckGroup");
                    add(statusChecks);
                    ListView statusChecksList = new ListView("statuses",
ContactUtil.getStatusCodes())
                    {
                        protected void populateItem(ListItem item)
                        {
                            item.add(new Check("scheck", item.getModel()));
                            item.add(new Label("status",
item.getModelObjectAsString()));
                        };
                    };
                    statusChecks.add(statusChecksList);
                
                    ...
                 
                }
                
                public void onSubmit(){
                        info("Search model " + getModelObject());
            
                        //Do I have to set a ResponsePage here? Or will it 
automatically remains
and reload the current page
                }
            
        }
        
        ...
}       
-- 
View this message in context: 
http://www.nabble.com/Filterable-DefaultDatatable-tf4018736.html#a11413575
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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