Forum


14:16

21/11/2008

I have gone through the steps of saving a datagrid to the server once a user changes the columns they want displayed, but what I have found is that when I use
var gridInfo = JSON.stringify($("#list").getGridParam());
the onSelectRow: paramater is not returned, which is a function that uses the id of the row to display some information elsewhere on the page. So what I'm now trying to do is just see if I can add the onSelectRow through using setGridParam after the grid has been generated. But this doesnt seem to be working. Here is what I have right now. The $data_grid_params is either build from the default values I have predefined, or pulled from the server if the user has saved them previously.
jQuery("list").jqGrid($data_grid_params).navGrid('#pager',{edit:false,add:false,del:false,search:false});
jQuery("list").setGridParam({onSelectRow: function(id){
if(id && id!==lastSel){
if ($('#job_data').is(":hidden")) {
$('#job_data').slideDown("slow");
}
lastSel=id;
loadJobListCalendar(id);
}
}});
jQuery("#change_columns").click(function() {
jQuery("#list").setColumns({
left:50,
top:50,
height:495
});
});
jQuery("#save_grid").click(function() {
jQuery('#list').setSelection('1');
var gridInfo = JSON.stringify($("#list").getGridParam());
saveFilter(gridInfo);
});
Any guidance here would be greatly appreciated.
01:36

Moderators
30/10/2007

Hello,
What is the error, that you recieve? With setGridParam you can
set anything possible including onSelectRow. I have successifully
implement in the development version of jqGrid the stringify and for
now it works fine. I suppose that you make eval of the string, before
passing it to jqGrid.
If possible before passing this parameters to the grid - check them to
see what you have. Also check what you have as string after stringify.
Regards
Tony
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.
02:24

Moderators
30/10/2007

Hello,
Since I have successed with this conversion - the problem is that
JSON.stringify does not support type function when convert to string.
This caouses not correct exporting of the events (functions). To work this
open the file that contain JSON.stringify method and at the end add
the following:
...
case 'boolean':
return String(arg);
// Adding
case 'function' :
return arg.toString();
// end of add
default:
return 'null';
}
.....
Regards
Tony
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.
03:22

Moderators
30/10/2007

Open the file that contain JSON.stringify function. Usuallly its name is
json.js. Just find stringify function and at end of this function add these
lines.
Regards
Tony
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:
66 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