Danilo M.
Danilo M.

Reputation: 1592

PagingToolbar does not work

I am using PagingToolbar to filter my result search, I want do display 20 result per page, but in my grid still display all records.

The bbar in my grid

bbar: Ext.create('Ext.PagingToolbar', 
store: store,
pageSize: 20,
displayInfo : true,
plugins: Ext.create('Ext.ux.ProgressBarPager', {})
}),

My Store

Ext.define('Mystore', {
extend: 'Ext.data.Store',
model: 'Mymodel',
pageSize: 20,
autoLoad: true,
remoteSort: true,
proxy: {
    type: 'rest',
    url: 'search',
    reader: {
        type: 'json',
        root: 'root',
        idProperty: 'id'
    },
    writer: {
        type: 'json',
        writeAllFields: true
    }
}

});

Anybody could help me ?? Thanks.

Upvotes: 0

Views: 1135

Answers (2)

Muthuramu Periyaiah
Muthuramu Periyaiah

Reputation: 366

Your Store must contain this parameter with start and limit and your backend need to use these parameters.

baseParams : { start:0, limit:20 }

In java backend,

            String startPage = request.getParameter("start");
    String limits = request.getParameter("limit");

It's kind of filter for your grid.

Upvotes: 2

JohnnyHK
JohnnyHK

Reputation: 311855

Your /search REST service that provides the data for the store needs to support the start, limit, and/or page parameters so that the store can request a single page of results at a time.

To support the limit parameter, your service must limit the number of returned results to no more than the count specified in that parameter. You'd typically implement that by passing the limit value through to the database query you're using to provide the results.

Upvotes: 2

Related Questions