title: JSQuery: How to add and retrieve column attributes?
body: <p>I'm reading a table from my database using JQuery and I want to create a data type attribute by column in order to perform certain operations by column. So far, I have the following:</p>
  <pre class="lang-js prettyprint-override"><code>var table = $('#maintable').DataTable({
    &quot;ajax&quot;: {
      &quot;type&quot;: &quot;GET&quot;,
      &quot;url&quot;: &quot;/cvs/PDFeditor/request/&quot;,
      &quot;data&quot;: function(d) {
        d.placeholder = &quot;asdf&quot;;
      }
    },
    &quot;columns&quot;: [{
        &quot;className&quot;: 'edit-control',
        &quot;orderable&quot;: false,
        &quot;data&quot;: null,
        &quot;width&quot;: &quot;12px&quot;,
        &quot;defaultContent&quot;: '&lt;button type=&quot;button&quot; class=&quot;btn btn-sm btn-primary&quot;&gt;&lt;span class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/span&gt;&lt;/button&gt;'
      }, {
        &quot;className&quot;: 'delete-control',
        &quot;orderable&quot;: false,
        &quot;data&quot;: null,
        &quot;width&quot;: &quot;12px&quot;,
        &quot;defaultContent&quot;: '&lt;button type=&quot;button&quot; class=&quot;btn btn-sm btn-danger&quot;&gt;&lt;span class=&quot;glyphicon glyphicon-minus-sign&quot;&gt;&lt;/span&gt;&lt;/button&gt;'
      }, {
        &quot;data&quot;: &quot;investor&quot;,
        &quot;class&quot;: 'inv-editable',
        &quot;data-type&quot;: 'investor'
      }, {
        &quot;data&quot;: &quot;amount&quot;,
        &quot;type&quot;: &quot;num-fmt&quot;,
        &quot;class&quot;: 'inv-editable',
        &quot;data-type&quot;: 'amount'
      }, {
        &quot;data&quot;: &quot;code&quot;,
        &quot;class&quot;: 'inv-editable',
        &quot;data-type&quot;: 'code'
      }
    ],
    &quot;pageLength&quot;: 15,
    &quot;order&quot;: [ [5, &quot;desc&quot;] ]
  });
  </code></pre>
  <p>My purpose is to store the &quot;data-type&quot; attribute into a variable to update the column in the database prior:</p>
  <pre class="lang-js prettyprint-override"><code>$('#maintable tbody').on('dblclick', '.inv-editable', function() {
    var value = $(this).text();
    var data_type = $(this).data(&quot;type&quot;)
  
    if (data_type == 'investor') {
      var input = &quot;&lt;input type = 'text' class = 'input-data' value ='&quot; + value + &quot;' class='form-control' type=&quot;investor&quot;&gt;&quot;;
    } else if (data_type == 'amount') {
      var input = &quot;&lt;input type = 'text' class = 'input-data' value ='&quot; + value + &quot;' class='form-control' type=&quot;amount&quot;&gt;&quot;;
    }
    
    $(this).html(input);
    $(this).removeClass(&quot;inv-editable&quot;)
  });
  </code></pre>
  <p>How can I retrieve the data-type attribute from the table definition?</p>
  <p>Thanks!</p>