title: Persisting jqGrid column preferences
body: <p>I've got a few jqGrids on my ASP.NET MVC 3 application that have a number of columns.  I added the following to the column definitions to default some columns to be hidden:</p>
  
  <pre><code>colModel: [
     { name: 'IceCreamID', hidden: true},
     { name: 'RecipeID', hidden: true }
  </code></pre>
  
  <p>and this works nicely.  Those columns aren't visible on my grid.</p>
  
  <p>Then I added this to implement the column chooser:</p>
  
  <pre><code>var grid = $('#icecreamGrid');
  grid.jqGrid('navButtonAdd', '#icecreamPager',
  { caption: "Columns", buttonicon: "ui-icon-calculator",
    title: "Choose Columns",
    onClickButton: function() {
       grid.jqGrid('columnChooser');
    }
  });
  </code></pre>
  
  <p>Great, brings up the column chooser now.  I then added the following to columns I never wanted to show up in the column chooser:</p>
  
  <pre><code>colModel: [
     { name: 'IceCreamID', hidden: true, hidedlg: true},
  </code></pre>
  
  <p>So I can now hide/show columns just fine.  Now, how would you persist this information?  DB?  As a cookie?  Other way?  Is there a preferred way to store this sort of information that is really a user preference rather than something related to the data itself?</p>
  
  <hr>
  
  <p><strong>More Info</strong></p>
  
  <p>Based on Oleg's comment below, I want to provide a little more information.</p>
  
  <p>The point here is that I've got grids with 10-15 columns which <em>could</em> be display based on the user's preference.  For a simple example, one of my grid's has the following 9 columns:</p>
  
  <pre><code>IceCream|ShortName|HasNuts|SugarAdded|LimitedRun|PromoItem|Facility|FirstRun|LastRun
  </code></pre>
  
  <p>Users can hide/show any of these 9 columns based on their personal preferences.</p>
  
  <p>What I want to do is provide a way to persist which columns a particular user wants to see so that s/he doesn't have to re-choose those columns to view each time the page with that grid is shown.</p>