Pagination in a Table


I’m trying to create a custom component which uses a table inside itself. My problem is that I’m trying to create pagination for the table - or to be more specific, the actual UI element doesn’t have the pagination buttons, but the table’s content should be one “page”. In other words, I want to limit the table’s data container to only contain (or paint in the UIDL) elements from index x to index y. Any suggestions how this could be accomplished?
In my component’s paintContent method I create an instance of a table and use its paint method to paint the tables UIDL.

Table t = new Table("",items);
// do some other stuff to the table

There was a paging table in Toolkit 4, but the implementation in Toolkit 5 is a bit half-way: there is an unfinished ITablePaging component on the client-side, but there’s currently no server-side component to handle it. If you are curious, you could try it by defining

    class PagingTable extends Table {
        public String getTag() {
            return "pagingtable";

and using that just like a normal Table, but it doesn’t really work very well.

So, for now, you have to handle the paging yourself somehow. I suppose you could implement a “PagingContainer” that acts as an filter to the actual container of the table data, and have buttons that control the container.

Do you have some reason for doing such low-level painting?

Sorry for checking the obvious, but did you try table.setPageLenght()?