title: Handsontable: Pass columns as parameter array from server
body: <p>Handsontable makes it very easy to send table values from a server an array:</p>
  
  <pre><code>$('#dataTable').handsontable( data: serverdataarray )
  </code></pre>
  
  <p>So far, so good. However, I would like to format some of the columns in the array.</p>
  
  <p>If I have a fixed number of columns I can easyly do this:</p>
  
  <pre><code>$('#dataTable').handsontable({
      data: serverdataarray ,
      columns: [
          { data: "Entity", type: 'text', renderer: orangeFF9900 },
          { data: "Geography", type: 'text', renderer: orangeFF9900 },
          { data: "Description", type: 'text', renderer: orangeFF9900 },
          { data: "cost_month1", type: 'numeric' },
          { data: "cost_month1", type: 'numeric' }
      ]
  });
  </code></pre>
  
  <p>My problem is that the data sent from the server will have a varying number of columns depending on a number of factors. Thus, I would like to be able to generate the columns formating array dynamicaly on the server and send it as an array too. I.e.:</p>
  
  <pre><code>var cols = [
          { data: "Entity", type: 'text', renderer: orangeFF9900 },
          { data: "Geography", type: 'text', renderer: orangeFF9900 },
          { data: "Description", type: 'text', renderer: orangeFF9900 },
          { data: "cost_month1", type: 'numeric' },
          { data: "cost_month1", type: 'numeric' }
      ]; // Strictly speaking this would be a string sent form the server, but you catch my drift
  
   $('#dataTable').handsontable({
      data: serverdataarray ,
      columns: cols
   });
  </code></pre>
  
  <p>However, on doing so, I end up with the following error <code>TypeError: method is not a function</code> <code>jquery.handsontable-0.9.9-full.js Line: 3028</code></p>
  
  <p>The line in question (3028) is the return line of the following function:</p>
  
  <pre><code>Handsontable.TableView.prototype.applyCellTypeMethod = function (methodName, td, row, col) {
      var prop = this.instance.colToProp(col)
      , cellProperties = this.instance.getCellMeta(row, col)
      , method = Handsontable.helper.getCellMethod(methodName, cellProperties[methodName]); //methodName is 'renderer' or 'editor'
  
      return method(this.instance, td, row, col, prop, this.instance.getDataAtRowProp(row, prop), cellProperties);
  };
  </code></pre>
  
  <p>Handsontable actualy manages to render correct number of columns on screen, although they are blank, unformatted and there is only one row so I'm gessing it is infering this much form the <code>serverdataarray</code> and not <code>cols</code>.</p>
  
  <p>Any suggestions on how to achive what I am looking for?</p>
  
  <p>I am open to changing the Handsontable sourcecode if need be.</p>
  
  <p>Thanks</p>