PDA

View Full Version : Paging grid - total pading error



ftalevi
29 Apr 2010, 11:45 AM
Hy guys, help me

i have a ext grid, and it dont paging...

the source:



$(document).ready(function() {

var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '/Formulario/BuscaMinhaEquipe',
dataType: 'json',
method: 'GET'
}),
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'totalCount',
fields: [
{ name: 'Editar', mapping: 'Codigo' },
{ name: 'Codigo', mapping: 'Codigo' },
{ name: 'Cpf', mapping: 'Cpf' },
{ name: 'Nome', mapping: 'Nome' },
{ name: 'Email', mapping: 'Email' },
],
sortInfo: {
field: 'Codigo',
direction: 'ASC'
}
})
});

var filters = new Ext.ux.grid.GridFilters({
encode: false, // json encode the filter query
local: true, // defaults to false (remote filtering)
filters: [
{
type: 'numeric',
dataIndex: 'Codigo'
}, {
type: 'string',
dataIndex: 'Nome'
}, {
type: 'string',
dataIndex: 'Cpf'
}, {
type: 'string',
dataIndex: 'Email'
}
]
});


var createColModel = function(finish, start) {
var columns = [
{
id: 'Editar',
header: 'Editar',
menuDisabled: true,
resizable: false,
editable: false,
fixed: true,
sortable: false,
dataIndex: 'Editar',
header: '',
width: 34,
heigth:24,
filterable: false,
renderer: renderIcon
},
{
dataIndex: 'Codigo',
header: 'Código',
width: 70,
sortable: true,
filterable: true
},
{
dataIndex: 'Cpf',
header: 'CPF',
id: 'Cpf',
sortable: true,
width: 100,
renderer: renderMaskCPF
},
{
dataIndex: 'Nome',
header: 'Nome do Cliente',
id: 'Nome',
sortable: true,
filterable: true
},
{
dataIndex: 'Email',
header: 'E-Mail',
id: 'Email',
sortable: true,
width: 150
}
];

return new Ext.grid.ColumnModel({
columns: columns.slice(start || 0, finish)
});
};

var grid = new Ext.grid.GridPanel({
border: false,
store: store,
colModel: createColModel(5),
autoExpandColumn: 'Nome',
loadMask: true,
plugins: [filters],
listeners: {
render: {
fn: function() {
store.load({
params: {
start: 0,
limit: 50
}
});
}
}
},
bbar: new Ext.PagingToolbar({
pageSize: 50,
store: store,
displayInfo: true,
displayMsg: "Página {0} - {1} de {2}",
emptyMsg: "nenhum cliente foi encontrado",
plugins: [filters]
}),
autoWidth: true,
autoHeight: true,
enableColumnResize: false,
enableDragDrop: false,
viewConfig: { forceFit: true },
renderTo: 'grid-example',
});

grid.getStore().load();
});my bbar show:


Page 1 of 7
Display 1 - 313 of 313




the sizePage should be 50!!

how can i fix it?

thanks

1 May 2010, 7:51 AM
You need to call load, and set parameters for start and limit.