Example

pagedisplay as input

This example page demonstrates the use of a disabled input field as page display instead of plain text. This way the page display has a fixed width and uses the same font as other form elements.

Javascript

$(function() {
    $("table")
        .tablesorter({widthFixed: true, widgets: ['zebra']})
        .appendTablesorterPagerControls({
            sizes: [2, 10, 30, 100], 
            initialSize: 10,
            pagedisplayInputSize: 15
        });
});

By setting the pagedisplayInputSize option, the page display is not inserted as plain (and styleable) text but into a disabled input field of the given size (15 characters).

Mini Table: 2 Lines

This is to demo that the pager controls won't be added to a table with no more rows than the minimum selectable table size (which is configured to 2 in this case)

Name
Major
Sex
English
Japanese
Calculus
Geometry
Student01 Languages male 80 70 75 80
Student02 Mathematics male 90 88 100 90

Small Table: 10 Lines

Demos that the initial page size will hold the whole table, but the pager controls are added nonetheless, since a smaller page size is configured to be selectable.

Name
Major
Sex
English
Japanese
Calculus
Geometry
Student01 Languages male 80 70 75 80
Student02 Mathematics male 90 88 100 90
Student03 Languages female 85 95 80 85
Student04 Languages male 60 55 100 100
Student05 Languages female 68 80 95 80
Student06 Mathematics male 100 99 100 90
Student07 Mathematics male 85 68 90 90
Student08 Languages male 100 90 90 85
Student09 Mathematics male 80 50 65 75
Student10 Languages male 85 100 100 90

Large Table

Name
Major
Sex
English
Japanese
Calculus
Geometry
Student01 Languages male 80 70 75 80
Student02 Mathematics male 90 88 100 90
Student03 Languages female 85 95 80 85
Student04 Languages male 60 55 100 100
Student05 Languages female 68 80 95 80
Student06 Mathematics male 100 99 100 90
Student07 Mathematics male 85 68 90 90
Student08 Languages male 100 90 90 85
Student09 Mathematics male 80 50 65 75
Student10 Languages male 85 100 100 90
^