Grid.setPageSize() has no effect

Hi All !

Could you tell, why the grid.setPageSize(5);

grid.addColumn(person -> Integer.toString(person.getYearOfBirth()))
                .setHeader("Year of birth").setSortable(true);
        grid.setDataProvider(new ListDataProvider<Person>( /*Big list*/));

has no effect ?
What need to add ?

Thanks, Igor

See the JavaDoc on setPageSize:

     * Sets the page size, which is the number of items fetched at a time from
     * the dataprovider.
     * <p>
     * Note: the number of items in the server-side memory can be considerably
     * higher than the page size, since the component can show more than one
     * page at a time.
     * <p>
     * Setting the pageSize after the Grid has been rendered effectively resets
     * the component, and the current page(s) and sent over again.
     * @param pageSize
     *            the maximum number of items sent per request. Should be
     *            greater than zero
    public void setPageSize(int pageSize) {

Hi Olly.
Does it make sense to have page size, which is affect UX part and fetch size ?
Thanks, Igor

Usually the default page size is a good compromise. Sometimes you might want to adjust it to be larger (to fetch data less often), but a small page size is usually not going to work to your advantage, because the UI will need to load data more often to make sure there is enough scrolling buffer.