I'm currently involved in a project that uses Grails, and using JqGrid as the main plugin for displaying tables. Data from tables is fetched from the database using Grails.
The problem is maintaining the table's persistence (like filter and list order) when moving to the other page. Because each table has its own set of pages (edit page, show page) and whenever i move from list page to edit page, and return back to the table page, the list's filtering will gone.
I've checked in here on how others did it like in here, and mostly it involves with cookies. But i was told that if possible to not rely on cookies due to security issues. I've done the coding to grab the filter from the jqGrid.
function saveFilter(grid){
var colModel = $(grid).jqGrid('getGridParam', 'colModel');
var colNames = $(grid).jqGrid('getGridParam', 'colNames');
var colNamesLength = colNames.length - 1;
var value = [];
for (var i = 0; i < colNamesLength; i++){
value[i] = $("#gs_"+colModel[i].name).val();
};
prefs = {
value: value,
grid: grid,
colNames: colNames,
colModel: colModel,
sorn: $(grid).jqGrid('getGridParam', 'sortname'),
sord: $(grid).jqGrid('getGridParam', 'sortorder'),
page: $(grid).jqGrid('getGridParam', 'page'),
rows: $(grid).jqGrid('getGridParam', 'rowNum')
};
}
Now the thing is, where do i go from here? Since i'm most likely cannot save the prefs as cookie, what other options could i possibly have? The prefs are needed to reload back the grid to its filtered condition after i return back from either edit or show page.
Is it possible to send the prefs to the controller, and have it send back to the jqGrid upon returning back to the list page? Or is Grails have this kind of feature that allows persistence in the list?
Thanks