title: How can I change the number of columns in Gridster?
body: <p>I have a a gridster based layout that will start with a set number of columns and a fixed number of tiles. Is there a way to change the number of columns once it has been set up? -- for example starting with 3 columns :</p>
  
  <blockquote>
    <p>(tile1 | tile2 | tile3 <br/>
    tile4 | tile5 | tile6)</p>
  </blockquote>
  
  <p>and changing it to a two column layout:</p>
  
  <blockquote>
    <p>(tile1 | tile2 <br/>
    tile3 | tile4 <br/>
    tile5 | tile6) <br/></p>
  </blockquote>
  
  <p>The change will be driven by user interaction.</p>
  
  <p>I have tried to use something like:</p>
  
  <pre><code>gridster = $("#gridster-container").gridster({
     widget_margins: [30, 30],
     widget_base_dimensions : [ 200, 170 ],
     max_cols:numberOfColumns,
     avoid_overlapped_widgets: true
  }).data('gridster');
  
  // user interaction
  
  gridster.options.max_rows = 2;
  
  gridster.init();
  </code></pre>
  
  <p>but that does not seem to work...</p>
  
  <p>I have tried manually changing the <code>data-row</code> and <code>data-col</code> values to the new positions, and called init() (and not called init).</p>
  
  <p>I have even tried changing the gridster code adding</p>
  
  <pre><code>    // HACK
      if (max_cols &amp;&amp; max_cols &lt; this.cols) {
          this.cols = max_cols;
      }
  </code></pre>
  
  <p>to the method <code>fn.generate_grid_and_stylesheet</code> (just after the line:</p>
  
  <pre><code>    if (max_cols &amp;&amp; max_cols &gt;= min_cols &amp;&amp; max_cols &lt; this.cols) {
          this.cols = max_cols;
      }
  </code></pre>
  
  <p>).</p>
  
  <p>I can get the tiles to move the the correct position using any of these options, but subsequent dragging behaviour is... odd.</p>
  
  <p>I have set up a jsfiddle (<a href="http://jsfiddle.net/qT6qr/" rel="nofollow">http://jsfiddle.net/qT6qr/</a>)  to explain what I mean (please excuse the gridster.min.js in line at the top of the fidddle, I couldn't find a cdn that I could use for it...).</p>
  
  <p>Thanks in advance</p>