PDA

View Full Version : Grid Filter on Local Paging



tina@user
14 Sep 2015, 5:53 AM
hi,

I have a grid where i have implemented Pagination on Client side using Paging Store.

Now, the problem i am facing is i have created a textbox for filtering the grid:-
Here I am using this code to filte the grid.



var value = Ext.getCmp('search-textfield').getValue();
var gridstore = Ext.getCmp(MachineGridExpanded').getStore();
debugger;
gridstore.clearFilter();
gridstore.filter('requestId',value,true,true);


But the filter operation is implemented only for successive data and not for previous datas.


For example if my data is in Page 5 and i search in current Page 2, i get the data.

But if i my current page is page 8, and i search with same data (present in page 5) then i do not get the data.
it shows NULL.


Please Help!!
Thanx in advance!!

scottmartin
14 Sep 2015, 1:39 PM
Are you searching remote data or local data?

Perhaps you could put together a small example of what you have:
https://fiddle.sencha.com/#home

keckeroo
14 Sep 2015, 2:13 PM
Hi,

If you are using memory paging for your proxy, you need to remember to set your store filtering to remoteFilter: true so that the proxy
does the filtering.

I've created a sample fiddle to show you how to correctly setup a grid with filtering and using the memory paging correctly.

https://fiddle.sencha.com/#fiddle/tsa

Regards,

Kevin
Sencha Support Team

tina@user
14 Sep 2015, 9:43 PM
My data is remote but my pagination is on client side so that every time server is not called.

I implement it using Paging Store.

Here is my store:-



Ext.define('VirtualMachinesStore', {

extend : 'App.ux.plugin.PagingStore',
storeId : 'VirtualMachinesStore',
model : 'VirtualMachinesModel',
remoteFilter: true
proxy: {
type: 'ajax',
enablePaging: true,
url : 'UserDashboard/getUserInstanceDetails/10604124/',

reader: {
type: 'json',
root: 'response',
totalProperty : 'totalCount'
}
}
});



Here is my paging toolbar in the view:-

And this is how i have created a textfield to filter the grid:-



dockedItems:[{
xtype : 'toolbar',
dock: 'top',
layout:'hbox',
cls:'current-VMtoolbar',
//xtype:'textfield',
items:[{
xtype:'label',
cls: 'virtual-machine-label',
html : '<span class="CurrentVm-title">Current Virtual Machines</span>'
},'->',{
xtype:'textfield',
id:'search-textfield',
emptyText:'Search by requestId',
listeners:{
specialkey: function(field, e){
if (e.getKey() == e.ENTER) {
field.fireEvent('onEnterKeyPress');
}}
}
},{
xtype:'button',
tooltip:'Search',
cls:'gridSearch-button',
action:'searchbyRequestId',
text:'S'
}]
},{
xtype:'pagingtoolbar',
dock: 'bottom',
store :store,
displayInfo : true,
displayMsg : '{0} - {1} of {2}',
emptyMsg : "No topics to display",
listeners:{
afterrender:function(_this, eOpts ){
Ext.ComponentQuery.query('#refresh')[0].hide();
}
}
}],

Here is my filter ACtion:-



var value = Ext.getCmp('search-textfield').getValue();
var gridstore = Ext.getCmp('CurrentVirtualMachineGridExpanded').getStore();
gridstore.clearFilter();
gridstore.filter('requestId',value);



Please Help !

I dnt know what to do!!

tina@user
14 Sep 2015, 9:45 PM
Hi,

If you are using memory paging for your proxy, you need to remember to set your store filtering to remoteFilter: true so that the proxy
does the filtering.

I've created a sample fiddle to show you how to correctly setup a grid with filtering and using the memory paging correctly.

https://fiddle.sencha.com/#fiddle/tsa

Regards,

Kevin
Sencha Support Team


My data is remote and remoteFilter:true shoes no difference.

:(

BEATRIZ SANTOS
9 Feb 2017, 5:02 AM
Hello guys from the past!

i've been searching for answers for my dynamical filtering in my store, and found something interesting for EXTJS 4.1.xxx:
Code:
store.getProxy().extraparams = {the query}
and then
store.load()
So, every request will added the parameter that you put hardcoded, so the pagination will bind the 'correct store'