문제

I want to build custom filtering header for Vaadin tables.

Can you please give some examples or solution to this problem.

I want to add a combo box or check box that will refine the search in the table like Excel columns.

도움이 되었습니까?

해결책

Book of Vaadin is a very good reference for vaadin implementation. The link consist of an example code like:

// Define the properties
table.addContainerProperty("lastname", String.class, null);
table.addContainerProperty("born", Integer.class, null);
table.addContainerProperty("died", Integer.class, null);
// Set nicer header names
table.setColumnHeader("lastname", "Name");
table.setColumnHeader("born", "Born");
table.setColumnHeader("died", "Died");

Is this what you ask for? If it isn't, can you please specify your question a bit more clearly?

edit: Vaadin Sampler also contains handful code samples.

다른 팁

We faced the problem of adding custom filters for Vaadin Table in our project as well.

As a solution we added a dynamic filter form above the table. It has become flexible and agile enough to apply filters.

We created Vaadin Addon in order to share our solution - Lexaden Grid.

You can find more information by the following link:

http://www.lexaden.com/main/entry/lexaden_grid

At the moment it is quite hard to add a custom component to do filtering with to the header of a table. It would require you to make your own version of Table by inheritance/copy&paste (not sure what is enough), and that is something most people wan't to avoid at the moment if anyway possible. The current implementation of the Table component is one of the most complicated components of Vaadin. It is doable if you insist putting components in header, but prepare for some serious thinking to get things to work.

I'd suggest making the filtering of data in containers with components just next/above your table. Hiding the table header is sometimes acceptable if there's no crucial information shown there. If you want something precisely on the header, it would require some empty headers and CSS positioning components on correct place.

You can always group table and other filtering components to one CustomComponent for easier abstraction.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top