PagedTable filtering problem

Hai friends,

I am using a PagedTable in my application. I tried to add a filter to the table it throws an exception

java.lang.ClassCastException: com.jensjansson.pagedtable.PagedTableContainer cannot be cast to$Filterable

This is my code

                  BeanItemContainer <Institution> institution = new BeanItemContainer<Institution>(Institution.class);
                  PagedTable institutionTable=new PagedTable("");

                    TextField search=new TextField();
		search.addStyleName("search small");
		search.setInputPrompt("institution name");
		search.addListener(new TextChangeListener() {
		    Filter filter = null;

		    public void textChange(TextChangeEvent event) {
		        Filterable f = (Filterable)
		        // Remove old filter
		        if (filter != null)
		        // Set new filter for the "Name" column
		        filter =new Like("instName", event.getText() + "%", false);

please help me how to add a filter to the PagedTable.

Thanks in advance…


at which line does the exception happens?

Filterable f = (Filterable)

at this line iam getting the error…

The problem here is that PagedTableContainer does not implement the interface Container.Filterable, but you are trying to cast it anyway. That’s why the exception is thrown.

If you would like to use filters with a PagedTable, you should extend the PagedTableContainer and implement Container.Filterable

Please have a look at the
add-on. I recently added support for filtered & paged table. If you don’t want to use the filtering features you can at least see/copy the changes you need to make to the PagedTable to get it working with a filterable container.

filter table will give the pagination functionality…?

Yes, it will, since the quite recent version 0.8.0. Look at the PagedFilteringTable class, it should do what you need.