Help FilterTable addons.

Dear , I added to my project FilterTable addons , I wonder if anyone has had the positive result , and I could not get to use it.

The problem I think is for the use of JPAContainer , and I do filling the table by hand, as follows :

 tabla.addContainerProperty("nombre", String.class, null);
        tabla.addContainerProperty("apepat", String.class, null);
        tabla.addContainerProperty("apemat", String.class, null);
        tabla.addContainerProperty("fono", String.class, null);
        tabla.addContainerProperty("celular", String.class, null);
        tabla.addContainerProperty("estado", String.class, null);
        UsuarioDAO cDAO = new UsuarioDAO();

        List<Usuario> c = cDAO.mostrarTodo();

        for (int i = 0; i < cDAO.mostrarTodo().size(); i++) {
            Item item = tabla.addItem(c.get(i).getId());
            item.getItemProperty("nombre").setValue(c.get(i).getNombre());
            item.getItemProperty("apepat").setValue(c.get(i).getApepat());
            item.getItemProperty("apemat").setValue(c.get(i).getApemat());
            item.getItemProperty("fono").setValue(c.get(i).getFono());
            item.getItemProperty("celular").setValue(c.get(i).getCelular());
            item.getItemProperty("estado").setValue(c.get(i).getEstado());
        }

In the example of the product(https://vaadin.com/directory#!addon/filteringtable) for its use goes something like:

filterTable.setFilterDecorator (new DemoFilterDecorator ());
filterTable.setFilterGenerator (new DemoFilterGenerator ());
filterTable.setContainerDataSource ( buildContainer ());

And donot how to implement it in my little example.

Thanks all.

Hi!

Just to clarify, are you having problems with JPAContainer, or creating your own FilterDecorator and FilterGenerator? With JPAContainer you don’t need to add container properties separately, it generates them by default based on the fields of your entity class. As for the FilterDecorator and FilterGenerator, there are example implementations of those in the addon page’s highlight section, or you can check out the sources
here
.

solved thanks… :slight_smile:

UsuarioDAO cDAO = new UsuarioDAO(); BeanItemContainer bic = new BeanItemContainer<Usuario>(Usuario.class, cDAO.mostrarTodo()); tabla.setContainerDataSource(bic); tabla.setVisibleColumns(new String[]{"nombre", "apepat", "apemat", "fono", "celular", "ciudad.nombre"}); tabla.setFilterBarVisible(true); Bye.