Posted by Pierre Cardeaux
on 14.01.2008 14:01
Hello everyone,

I'm doing a project in .NET and I'm using some LiveGrids.
Does anyone have a good idea how to remember what filtering texts have 
been typed?
Or has anyone tried anything like this before?

What I want is a user to filter a grid, be able to leave the page,
then come back with their filters still in place.

My first thought would be to store a comma separated list as a session 
variable
and save it every time someone filters the grid.  Then on grid load, 
reading the values back out and into the filter boxes.

thx,
AirPierre
Posted by Ed Demaio
on 14.01.2008 14:50
I've started creating objects to represent the different aspects of the 
LiveGrid in my .NET app.  One of the classes is just a filter object 
that contains the filter column, filter operand, filter operator, and 
filter length. These are just the value posted by the LiveGrid.  See 
http://dowdybrown.com/dbprod/wiki/pmwiki.php?n=Main.RicoDataSource

To be honest, I'm not exactly sure what anything besides the column and 
operator are used for - so I ignore them.  I also have a sort class to 
store sort information about the grid.  Then I have a LiveGridParams 
class that has a collection of filter objects, a sort object, the 
livegrid id, the offset, and the pagesize.

If you use an object like that you could just store it in a session 
variable or cookie named liveGridTableId_params, where liveGridTableId 
would be replaced with the id of the table.  Then you run into the 
problem of only using the stored livegrid params on the first load of 
page, and storing those params when leaving the page.  I guess it would 
be easier to always store the params when a live grid requests an 
update, and then always load the livegrid from the session/cookie.

I would post an example of what I've been working on, but it's embedded 
in a huge application.  I've been working on creating a simple example 
to demonstrate everything - everything being all the livegrid objects 
and how to use them in the new ASP.NET MVC framework, and also 
converting the livegrid params into linq queries - as soon as it's ready 
I'll post it on the forums...
Posted by Matt Brown
on 15.01.2008 03:09
Saving filter settings to cookies is built-in to LiveGrid: see the 
saveColumnInfo option. You can also use it to save sort settings.

Matt
Posted by Pierre Cardeaux
on 15.01.2008 15:00
thanks! I see that saveColumnInfo and I set filters to true

It is correctly re-filtering when the grid reloads,
but the filter text isn't getting put back into the box,
neither are the dropdowns getting set to the correct choice.

Is there something else I need to set up?
Posted by Pierre Cardeaux
on 25.01.2008 16:01
I have a LiveGrid with filtering boxes.
How do I make a link that will remove all the filters at the same time?

Here's the problems I'm having:
I can delete all the the values in the boxes,
but when one filter box value changes, the grid reloads
and forgets that the other boxes have changed too.
so columns are still filtered on those other columns.

Is there a way to clear them all out... then reload the whole grid?
Posted by Matt Brown
on 26.01.2008 14:35
Just call "grid.clearFilters()".

To see how this works, type into 2 or more textboxes in ex3.asp/aspx/php 
so that you are filtering 2 or more columns. Then double-click on the 
grid to invoke the pop-up menu, and select "Filter By->Remove all 
filters". Notice that all of the textboxes are cleared and then the grid 
reloads. This occurs because a removeFilterFunc parameter is being 
supplied when column.setFilter() is called. Each removeFilterFunc is 
then invoked when grid.clearFilters() is called.

Matt