ironandsteel
5 Feb 2012, 9:01 AM
I have a grid app in which I want to use filters. I am doing remote filtering. I initially load all the data into the store and it displays fine. I select a "category code" from a combobox, and this calls filter on the store.
Since the store is set to remote filtering, it makes an ajax call to my server script, and I get back a new set of records with my filter applied. So far so good.
Lets say that this filter operation returned 7 records. Now, if I pick another filter category which has, say, 11 results, the correct ajax call is made, and the correct data is returned, including the correct count of records in the json. The problem is that only the first 7 records are shown in the grid rather than all 11.
What is the correct way to cause it to recalculate how many rows to display in the grid?
Here is the store:
// create the contractor Data Store
var ContractorStore = Ext.create('Ext.data.Store',
{
id: 'contstore',
pageSize: 200
model: 'Contractor.Model',
autoLoad: false,
autoSync: true,
remoteSort: true,
remoteFilter: true,
buffered: true,
purgePageCount: 0,
proxy: {
id: 'contractorStoreProxy',
autoSync: true,
type: 'ajax',
api: {
read: '../scripts/getContListChunk.php', // works fine
create: '../scripts/createContRecord.php', //
update: '../scripts/updateContRecord.php',
destroy: '../scripts/deleteContRecord.php'
}
,reader: {
type: 'json',
root: 'rows',
totalProperty: 'total'
}
,writer: {
type: 'json',
writeAllFields: false,
root: 'rows'
}
,simpleSortMode: true
}
});
Here is how the store gets loaded:
ContractorStore.prefetch(
{
start: 0
,limit: 5000
,filters:[
{id: "sel", property: "sel", value: 'false' },
{id: "catcode", property: "catcode", value: 'all'}
]
,callback: function()
{
ContractorStore.guaranteeRange(0, 600);
}
});
Here is where I call filter on the store as a result of selecting a filter category from the combobox. "Sel" is a checkbox that is for another purpose.
this.ownerCt.ownerCt.store.filter([
{id: "sel", property: "sel", value: selOnly },
{id: "catcode", property: "catcode", value: catCode}
]);
Currently I'm using 4.1b2.
Thanks-
LK
Since the store is set to remote filtering, it makes an ajax call to my server script, and I get back a new set of records with my filter applied. So far so good.
Lets say that this filter operation returned 7 records. Now, if I pick another filter category which has, say, 11 results, the correct ajax call is made, and the correct data is returned, including the correct count of records in the json. The problem is that only the first 7 records are shown in the grid rather than all 11.
What is the correct way to cause it to recalculate how many rows to display in the grid?
Here is the store:
// create the contractor Data Store
var ContractorStore = Ext.create('Ext.data.Store',
{
id: 'contstore',
pageSize: 200
model: 'Contractor.Model',
autoLoad: false,
autoSync: true,
remoteSort: true,
remoteFilter: true,
buffered: true,
purgePageCount: 0,
proxy: {
id: 'contractorStoreProxy',
autoSync: true,
type: 'ajax',
api: {
read: '../scripts/getContListChunk.php', // works fine
create: '../scripts/createContRecord.php', //
update: '../scripts/updateContRecord.php',
destroy: '../scripts/deleteContRecord.php'
}
,reader: {
type: 'json',
root: 'rows',
totalProperty: 'total'
}
,writer: {
type: 'json',
writeAllFields: false,
root: 'rows'
}
,simpleSortMode: true
}
});
Here is how the store gets loaded:
ContractorStore.prefetch(
{
start: 0
,limit: 5000
,filters:[
{id: "sel", property: "sel", value: 'false' },
{id: "catcode", property: "catcode", value: 'all'}
]
,callback: function()
{
ContractorStore.guaranteeRange(0, 600);
}
});
Here is where I call filter on the store as a result of selecting a filter category from the combobox. "Sel" is a checkbox that is for another purpose.
this.ownerCt.ownerCt.store.filter([
{id: "sel", property: "sel", value: selOnly },
{id: "catcode", property: "catcode", value: catCode}
]);
Currently I'm using 4.1b2.
Thanks-
LK