Forum
20:41
17/04/2014
I've been looking around for a good jquery table and came across jqGrid. It seems like a very useful tool. One thing I was hoping to find is the ability for users to create a filter, name it, save it, and then access it later for other datasets.
I've seen the Search Templates, so understand the filters can be created, named, and saved in some manner. However, it would be better if the user could use various search features, find what they like, then save and name the search for later.
Would it be hard to do something like that? Is there some way already?
12:05
Moderators
30/10/2007
Hello,
This is possible and requiere a little programing effort to make this happen.
The search rules are a parameter in the grid postData and this parameter is named filters.
Every time the user perform a serach you can save the filter using
var currentfilter = $("#grid").jqGrid('getGridParam','postData').filters;
this filter can be saved depending on your needs and later you can invokethe serech this way
$("#grid").jqGrid('setGridParam',{postData: { filters : currentfilter }, search:true });
$("#grid").trigger("reloadGrid");
Hope this help
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
20:04
17/04/2014
Thank you for the information.
Instead of trying to save each search a user performs, which they may not wish to keep, is there a way to add a button to the search form so they can click, name, and save the search?
Or, even a custom form on the html page that captures the filter information and allows them to save. I guess that is how I might do it with the information you gave me.
I know there would need to be some backend process for saving (php, mysql, etc) which can be built.
11:50
Moderators
30/10/2007
Hello,
Currently there is no such button on the search form.
As for the custom form you can make a button in the page and make it so that when the user click on it to save the curren filter.
You my ask for the name to be saved and then save
var filters =[];
$("#mybutton").click(function(){
// ask the user to enter a short name let say
var currentname = 'test1';
// get the filter
var currentfilter = $("#grid").jqGrid('getGridParam','postData').filters;
// push it into array
filters[currentname] = currentfilter ;
// you vcan save it to server using ajax.
alert('Current filter is saved!');
});
The way to run the saved filter is to read this array and when the user select the desired filter to run the code from my previous mail.
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
57 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66