Directory

← Back

PagedTable

A Table component that uses pages instead of scrolling

Author

Contributors

Rating

NOTE: 0.6.3 is for Vaadin 6 0.6.5 is for Vaadin 7 0.7.0 is for Vaadin 8 in compatibility mode

Download the version depending on which version of Vaadin you are using!!

0.7.0 Is for compatibility mode, for migrating from Vaadin 7 to Vaadin 8 projects. When you have migrated, I suggest you switch from Table to Grid. GridExtensionPack Add-on provides a Paged Container and that does similar things to Grid as this addon does to Table.

PagedTable

PagedTable is a component that behaves in the same matter as the Vaadin core Table, except that it has multiple pages instead of scrolling to show more entries.

Paged Table

You can set the amount of rows to be shown with setPageLength. Changing pages can be implemented yourself with the methods nextPage(), previousPage(), getCurrentPage(), getTotalAmountOfPages() or you can ask the table to create a control layout for you with createControls (returns a HorizontalLayout).

The table has a handler, PageTableEvents, that can be set with setHandler. The handler will notify you when viewed page has changed

Known issues:

  • setHeight causes wrong amout of rows to be rendered and renders one (half) row too much. This will cause a very little scrollable scrollbar to the table. Use setPageLength instead if possible.
  • Having different height rows will throw off the rendering. Same symptoms as above.

Further Improvements to be made:

  • Figure out how the component reacts with live changes to the real container after the original rendering.

The component is still work in progress and I'm actively working on making it better. If you test it out, please, show your interest and post your feedback to the forum thread in "related links" so that I can get around and fix it. More discussion about the component can be found in the same thread. Don't forget to vote!

Sample code

public class TabletestApplication extends Application {
    @Override
    public void init() {
        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setSizeUndefined();
        Window mainWindow = new Window("Tabletest Application");
        IndexedContainer container = new IndexedContainer();
        container.addContainerProperty("foo", String.class, null);
        container.addContainerProperty("bar", String.class, null);
        container.addContainerProperty("baz", String.class, null);
        for (int i = 0; i < 100; i++) {
            Item item = container.addItem(i);
            item.getItemProperty("foo").setValue("foo " + i);
            item.getItemProperty("bar").setValue("bar");
            item.getItemProperty("baz").setValue("baz");
        }
        PagedTable table = new PagedTable("footable");
        table.setContainerDataSource(container);
        table.setPageLength(15);
        mainWindow.addComponent(table);
        mainWindow.addComponent(table.createControls());
        setMainWindow(mainWindow);
    }
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

This is the Vaadin 8 PagedTable in compatibility mode, for migrating from Vaadin 7 to Vaadin 8 projects. When you have migrated, I suggest you switch from Table to Grid. GridExtensionPack Add-on provides a Paged Container and that does similar things to Grid as this addon does to Table.

Thanks to Johannes for motivation :)

Released
2017-04-01
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.0+
Vaadin 7.0+ in 0.6.5
Vaadin 6.0+ in 0.6.3
Vaadin 6.2+ in 0.4.1
Vaadin 6.4+ in 0.1.0
Browser
Browser Independent
Online