View Full Version : GridPanel PagingToolbar & filter a store

31 Jan 2008, 5:58 AM
I'm filtering a grid with a Combobox, but when It pass to the next page, the filter is lost.
I was thinking to handle it with a Event listener, but I can't make it works.
If anyone has already done this before, I appreciate your support.

Thanks in advance.

This is my Store

[PHP]//# Almacen de datos
var storeGrilla = new Ext.data.Store({

proxy : new Ext.data.HttpProxy({
url: 'httphandlers/stores.ashx?opcion=storeGrillaReportexEmpresa&tarea=cargarDatos',
method : 'GET'
// baseParams:{opcion:'storGrillaReportexEmpresa', tarea:'cargarDatos'},
reader: new Ext.data.XmlReader({
totalRecords: "TOTAL_REGISTROS", // MUY IMPORTANTE, Cuenta el total de los registros para usar en la paginaci

31 Jan 2008, 11:23 AM
Maybe this can help you:

my filter search code:

setSearchValue : function(item,grid){
var ds = grid.getDataSource();

var searchValueTexfield = Toolbar.getElementByName(grid.tb,'searchValueTexfield');
if(searchValueTexfield.el.value != 'Buscar...' && searchValueTexfield.el.value != ''){
ds.baseParams.searchValue = searchValueTexfield.el.value.replace(/\*/g, '%');

ds.baseParams.searchField = grid.itemSearchField.searchField;

if(ds.baseParams.searchValue && ds.baseParams.searchField){
ds.reload({params: {start:0, limit:25}});

is just baseParams

31 Jan 2008, 12:35 PM
Can you put the code that's related with using the "setSearchValue".
I can't make me the idea about how to include it to my own script.

I need to know how to handle the event that triggers the filter to do its job again.

Thanks in advance.

Gracias por la ayuda. :)

3 Feb 2008, 10:49 AM
Add a handler to the load event on the store.
In that handler, check for the value on the combobox, and if it has a value, then you can call your filter function.

5 Feb 2008, 5:31 AM
Thanks halkon_polako, it works great.

storeGrilla.on('load', function() {