PDA

View Full Version : Local filter grid back wrong paging.



Marcelo Augusto
3 May 2016, 5:58 AM
I'm using the change event to verify that the value of a datefield changed and make a local filter on the store. However, the store always sends the total number of records in the pagination and instead of bringing all data (fewer than the page limit) for the first page, the rest ends up on the second page.


filtrarData: function(thisComponent, newValue, oldValue, e0pts) {
if(newValue) {
var store = Ext.getStore('pontoeletronico');
store.clearFilter();
store.filter({
property: 'dataPonto',
value: newValue
});
var tip = Ext.create('Ext.tip.ToolTip', {
target: thisComponent.el,
trackMouse: true, //ACOMPANHA O MOUSE ENQUANTO O MESMO ESTIVER DENTO DO CAMPO
//iconCls: 'informacao',
html: 'Deixe o campo em branco para rever todos os registros novamente'
});
} else {
var store = Ext.getStore('pontoeletronico');
store.clearFilter();
}
},

Store code:

Ext.define('Packt.store.ponto_eletronico.PontoEletronico', { extend: 'Ext.data.Store',


alias: 'store.pontoeletronico',
requires: [
'Packt.model.ponto_eletronico.PontoEletronico'
],


model: 'Packt.model.ponto_eletronico.PontoEletronico',


storeId: 'pontoeletronico',


autoLoad: true,

proxy: {
type: 'ajax',
url: 'php/ponto_eletronico/listaPontoEletronico.php',


reader: {
type: 'json',
root: 'data'
}
}
});

Gary Schlosberg
3 May 2016, 7:59 AM
So the data being returned should fit on the first page, but part of it is being place in the second page? Can you post more of your code such as that of the store?

Marcelo Augusto
3 May 2016, 1:38 PM
I edited the code. Thanks for the feedback!