Documentation for a historical release of Infusion: 1.3
Please view the Infusion Documentation site for the latest documentation.
If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.

How do I set the initial page size in Pager

Question
How do I set the initial page size in Pager?

Answer
To adjust initial page size, you will have to first locate where the pager is initialized, then add the
following block into your pager options:

model: {
    pageSize: <new page size>
}

If you created your pager based on the Pager tutorial at http://wiki.fluidproject.org/display/fluid/Pager+Tutorial, then look for the following block:

jQuery(document).ready(function () {
    var opts = {
        // we'll go into this in a moment
    };
    fluid.pager("#demo-pager-container", opts);
});

Next, checking the Pager API, http://wiki.fluidproject.org/display/fluid/Pager+API#PagerAPI-optionsdescription, under header "The Pager Model", we see the following:

Field

Type

Primary/Computed

Description

pageSize

integer

Primary

The number of "items" which may be shown on a page

This tells us that if we want to modify the initial pageSize, we will have to modify the model option, as follow:

var opts = {
     model: {
        pageSize: <new page size>
    }
};

Now, let's put this option into the pager, assuming 20 is the new page size

jQuery(document).ready(function () {
    var opts = {
        model: {
            pageSize: 20
        }
    };
    fluid.pager("#demo-pager-container", opts);
});

That's it! More information can be found here http://wiki.fluidproject.org/display/fluid/Pager+Tutorial.