views:

429

answers:

1

Hi,

I have worked on several projects with a lot of data tables. The tables had sorting, filtering and paging of course on server side and with help of the db
(all databases has implemented sording, filtering -where and limit the returned results).

When workig on real application there are a thousands of even a millions rows.

But I have seen several JSF dagatable components.
They implement pagination, sorting and filtering on client side!! According to me this is very silly. This technology is called enterprise and they sort the data on the client side with java script!

I have not seen any good JSF data grid that has build in features for sorting, filtering and lazy loading on the server side.

Why is that? Am I looking in wrong direction or really there in no build support for this. Lately I am testing primefaces and lazy loading datatable. It really works fine, but the table i can only lazy load. If you add sort and filter then the problems begin.

Conclusion: Is there any datatable JSF component than can perform lazy load pagination, and filtering and sorting on server side. If I need to implement my own solution thanks to the teams that made client side sorting and filtering, they are useless.

Regards

+2  A: 

No, there isn't. Because the component library cannot know what will be the persistence mechanism.

However, many data tables offer options for presenting this. For example richfaces's datatable has the so called DataModel. For example what we did was:

public class CustomDataProvider implements DataProvider<ClassToShow>,
        Sortable2, Filterable { .. }


public class PagingExtendedTableDataModel<T> extends ExtendedDataModel implements
        Serializable, Modifiable {

    private DataProvider dataProvider;
    private Object rowKey;
    private List wrappedKeys;
    private Map wrappedData;
    private Integer rowCount;
    private Integer rowIndex;
    private List<FilterField> filterFields;
    private List<SortField2> sortFields;

    public PagingExtendedTableDataModel(DataProvider<T> dataProvider) { .. }

}

You will have to implement all the methods in a way that suits your persistence mechanism

Bozho