PDA

View Full Version : extjs persist filter criteria & sort oders



amitkumarchauhan
30 Apr 2012, 5:49 AM
I am building grids using extjs, which allows sorting & filtering; same grid is used for tickets as well as for requirements (2 different entities).My requirement is that when user navigates to tickets for 2nd time ;he should get data & filters as per criteria set by him during his earlier visit (Say High priority tickets sorted descending on date identified).
I am storing this criteria in session; hence i an getting such data as per filter criteria & sort order from server & i can provide Priority=High & Sort order Descending on Date Identified column from server json too but not sure what should be the exact format for grid to show this criteria in date column header filter as well as priority header filter.Help required.

scottmartin
30 Apr 2012, 11:14 AM
You can add a filter with something like:



{ // button
text: 'FILTER',
handler: function() {

var myfilters= [{
type: 'numeric',
dataIndex: 'price',
value: {gt: 50}
}];

grid.filters.addFilters(myfilters);
}
}


Regards,
Scott.

amitkumarchauhan
2 May 2012, 1:04 AM
This will add new filter i guess, i want when i visit that page 2nd time & click on filter on header of columns it should display selected date identified & rest all filter criteria which were used previously.
Also sorting icon & order on previously sorted column

amitkumarchauhan
3 May 2012, 11:16 PM
Can somebody help?

amitkumarchauhan
6 May 2012, 8:37 PM
still looking for help

amitkumarchauhan
8 May 2012, 5:54 AM
Still waiting for update :(

scottmartin
9 May 2012, 5:24 AM
You will need to save/restore that state of you sort/filter. The grid will not perform this unless you tell it to.
See if this will help:
http://www.sencha.com/forum/showthread.php?137142

Regards,
Scott.

amitkumarchauhan
10 May 2012, 2:41 AM
Thanks, what about sorting column & order?

scottmartin
10 May 2012, 8:41 AM
When you run the following example and change the column sorting, then reload the grid, does it save the state of the sort?
http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/grid/array-grid.html

Regards,
Scott.

amitkumarchauhan
11 May 2012, 2:04 AM
Thanks, yes it stores sort order too but it is stored in browser cookies so if cookies are cleared info will get lost.I am storing such information in DB, is it possible to provide both filtering values & sort order during rendering of grid itself ie while configuring grid columns/filters etc?

scottmartin
11 May 2012, 8:11 AM
Here is a extension that will allow for remote sessions storage:
http://www.sencha.com/forum/showthread.php?141207

Regards,
Scott