I have a JQGrid and a column chooser implemented on the grid. I want to save the user selected column settings(hidden and visible columns and column order)into a database table and so need to fire a query when the ok button in the column chooser is pressed. How can I do this? Also, how can I get the state(what columns are hidden and visible) of the user selected JQGrid after the user has made changes using the column chooser in a format which I can use to insert into the table?
Asked
Active
Viewed 1,058 times
0
-
1Look at [the demo](http://www.ok-soft-gmbh.com/jqGrid/OK/ColumnChooserAndLocalStorage2_singleSelect.htm), which I created for [the answer](http://stackoverflow.com/a/31663268/315935). It shows how to save the grid state in `localStorage` of the web browser. You can modify the code to save the settings in the database, but probably saving in the `localStorage` will be already enough. – Oleg May 09 '16 at 13:00
-
If it is saved in the database I think The best way to do this is to construct the Grid Config on the server side and send it to the client side as json, then the grid will be created based on that. It will be $("#myGrid").jqGrid({/*my server side dynamic grid config*/}) – Helen Araya May 09 '16 at 19:10
-
You can save user setting by getting parameters from `grid.jqGrid('getGridParam', 'colModel')` inside `done: function(){}`. You can using AJAX to save into database, then adjust `colModel` function with it parameter. Sorry for my english. – Rio Dermawan Jul 20 '16 at 10:33