Pager layout can be defined declaratively with pageModel.layout.

['first','prev', 'next','last', "|", "strPage"]

Localization strings like strPage can be further customized:

strDisplay: "{0} to {1} of {2}",
strPage: "Page {0} / {1}"
Order ID
Customer Name
Product Name
Unit Price
Quantity
Order Date
Required Date
Shipped Date
 
 
 
 
 
 
 
 
#
 
No rows to display.
Loading...


127
 
1
2
    $(function () {
3
        var colM = [
4
            { title: "Order ID", width: 100, dataIndx: "OrderID" },
5
            { title: "Customer Name", width: 130, dataIndx: "CustomerName" },
6
            { title: "Product Name", width: 190, dataIndx: "ProductName" },
7
            { title: "Unit Price", width: 100, dataIndx: "UnitPrice", align: "right" },
8
            { title: "Quantity", width: 100, dataIndx: "Quantity", align: "right" },
9
            { title: "Order Date", width: 100, dataIndx: "OrderDate" },
10
            { title: "Required Date", width: 100, dataIndx: "RequiredDate" },
11
            { title: "Shipped Date", width: 100, dataIndx: "ShippedDate" },
12
            { title: "ShipCountry", width: 100, dataIndx: "ShipCountry" },
13
            { title: "Freight", width: 100, align: "right", dataIndx: "Freight" },
14
            { title: "Shipping Name", width: 120, dataIndx: "ShipName" },
15
            { title: "Shipping Address", width: 180, dataIndx: "ShipAddress" },
16
            { title: "Shipping City", width: 100, dataIndx: "ShipCity" },
17
            { title: "Shipping Region", width: 110, dataIndx: "ShipRegion" },
18
            { title: "Shipping Postal Code", width: 130, dataIndx: "ShipPostalCode" }
19
        ];
20
        var dataModel = {
21
            location: "remote",            
22
            dataType: "JSON",
23
            method: "GET",
24
            url: "/pro/invoice/get"
25
            //url: "/invoice.php", //for PHP
26
        }
27
        var pageModel = { 
28
            type: "local", 
29
            rPP: 20, strRpp: "{0}", 
30
31
            //customize localization strings.
32
            strDisplay: "{0} to {1} of {2}",
33
            strPage: "Page {0} / {1}",
34
                 
35
            layout: ['first','prev', 'next','last', "|", "strPage"]                
36
        }   
37
        var grid1 = $("div#grid_paging").pqGrid({
38
            width: 900,
39
            height: 300,
40
            showTitle: false,
41
            collapsible: false,            
42
            pageModel: pageModel,                      
43
            toolbar: {
44
                cls: 'pq-toolbar',
45
                items: [
46
                    {
47
                        type: 'button',
48
                        label: "Custom layout",
49
                        listener: function() {
50
                            //debugger;
51
                            //this.pager().destroy();
52
                            this.option('pageModel.layout',['strDisplay', '|',"strPage", "|", "first","prev","next","last"])
53
                            this.refresh();
54
                        }
55
                    },
56
                    {
57
                        type: 'button',
58
                        label: "Default layout",
59
                        listener: function() {
60
                            //debugger;
61
                            //this.pager().destroy();
62
                            this.option('pageModel.layout',$.paramquery.pqPager.defaults.layout)
63
                            this.refresh();
64
                        }
65
                    },
66
                    { type: 'separator'},
67
                    {
68
                        type: 'select',
69
                        cls:'rpp',
70
                        label: "Rpp: ",
71
                        value: pageModel.rPP,
72
                        options: [10, 20, 50, 100, 1000],
73
                        listener: function(evt) {
74
                            this.option('pageModel.rPP', $(evt.target).val())
75
                            this.refreshDataAndView();
76
                        }
77
                    },
78
                    {
79
                        type: 'textbox',
80
                        cls: 'curpage',
81
                        label: "Page No: ",
82
                        listener: {
83
                            timeout: function(evt) {
84
                                this.goToPage({page:$(evt.target).val()})
85
                            }
86
                        }
87
                    },
88
                    { type: 'separator'},
89
                    {
90
                        type: 'button',
91
                        label: "Prev",
92
                        cls:'prev',
93
                        listener: function() {
94
                            var page = this.option('pageModel.curPage');
95
                            this.goToPage({page: page-1})
96
                        }
97
                    },
98
                    {
99
                        type: 'button',
100
                        label: "Next",
101
                        cls:'next',
102
                        listener: function() {
103
                            var page = this.option('pageModel.curPage');
104
                            this.goToPage({page: page+1})
105
                        }
106
                    },
107
                    {
108
                        type: 'button',
109
                        label: "Toggle pager",
110
                        //cls:'next',
111
                        listener: function() {
112
                            this.pager().widget().toggle()
113
                            this.refresh();
114
                        }
115
                    }
116
                ]
117
            },
118
            dataModel: dataModel,
119
            colModel: colM,
120
            wrap: false, hwrap: false,
121
            //freezeCols: 2,            
122
            numberCell: { resizable: true, title: "#" },
123
            title: "Shipping Orders"
124
        });
125
    });
126
127
ParamQuery Pro Eval