title: How to get data from selected row, Datatables
body: <p>ok, finally i made though to get id show in datatables but not visible on grid.</p>
  
  <p>i want to get the id, throught jquery selector or any other good way if possible.</p>
  
  <p>Here is the Output HTML</p>
  
  <pre><code>&lt;table class="table table-bordered table-condensed table-hover table-striped dataTable no-footer" id="ManageForms" role="grid" aria-describedby="ManageForms_info" style="width: 1618px;"&gt;
                          &lt;thead&gt;
                          &lt;tr role="row"&gt;&lt;th class="ui-state-default sorting" tabindex="0" aria-controls="ManageForms" rowspan="1" colspan="1" style="width: 351px;" aria-label="Form Name: activate to sort column ascending"&gt;Form Name&lt;/th&gt;&lt;th class="ui-state-default sorting" tabindex="0" aria-controls="ManageForms" rowspan="1" colspan="1" style="width: 324px;" aria-label="Form Path: activate to sort column ascending"&gt;Form Path&lt;/th&gt;&lt;th class="ui-state-default sorting" tabindex="0" aria-controls="ManageForms" rowspan="1" colspan="1" style="width: 535px;" aria-label="Form CI Path: activate to sort column ascending"&gt;Form CI Path&lt;/th&gt;&lt;th class="ui-state-default sorting" tabindex="0" aria-controls="ManageForms" rowspan="1" colspan="1" style="width: 258px;" aria-label="Actions: activate to sort column ascending"&gt;Actions&lt;/th&gt;&lt;/tr&gt;
                          &lt;/thead&gt;
  &lt;tbody&gt;&lt;tr role="row" class="odd" data-id="1"&gt;&lt;td&gt;Dashboard&lt;/td&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;admin/dashboard/System&lt;/td&gt;&lt;td&gt;&lt;a class="editBtnFunc" data-toggle="modal" href="#editBtnModal"&gt;&lt;i class="fa fa-pencil fa-fw fa-2x" style="color: #666666"&gt;&lt;/i&gt;&lt;/a&gt;&lt;a id="deleteBtn" href="#"&gt;&lt;i class="fa fa-times fa-fw fa-2x" style="color: #ff0000"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr role="row" class="even" data-id="2"&gt;&lt;td&gt;Dashboard&lt;/td&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;admin/dashboard/Users&lt;/td&gt;&lt;td&gt;&lt;a class="editBtnFunc" data-toggle="modal" href="#editBtnModal"&gt;&lt;i class="fa fa-pencil fa-fw fa-2x" style="color: #666666"&gt;&lt;/i&gt;&lt;/a&gt;&lt;a id="deleteBtn" href="#"&gt;&lt;i class="fa fa-times fa-fw fa-2x" style="color: #ff0000"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;
                          &lt;/table&gt;
  </code></pre>
  
  <p>Just need to get the <code>data-id</code> from the <code>tr</code>.</p>
  
  <p>i tried <code>this.closest('tr')</code> but got error.</p>
  
  <p>any suggestions..</p>
  
  <p>Here is the script.</p>
  
  <pre><code>&lt;script&gt;
          $(document).ready(function() {
              var oTable =  $('#ManageForms').dataTable({
                   "aoColumns": [
                       /* ID */   {
                           "bVisible":    false,
                           "bSortable":   false
                       },
                       /* Form Name */  null,
                       /* Form Path */  null,
                       /* Form CI Path */  null,
                       /* Actions */  null
                   ],
  
                  "bServerSide":true,
                  "bProcessing":true,
                  "bJQueryUI": true,
                  "sPaginationType": "full_numbers",
                  //"bFilter":true,
                  //"sServerMethod": "POST",
                  "sAjaxSource": "{{base_url()}}admin/configurations/listForms_DT/",
                  "iDisplayLength": 2,
                  "aLengthMenu": [[2, 25, 50, -1], [2, 25, 50, "All"]],
                  /*"sEcho": 1,
                  "columns":[
                      {data:"FormName"},
                      {data:"FormPath"},
                      {data:"FormCIPath"},
                      { "data": null,
                          "defaultContent": "&lt;a href='#editBtnModal' class='editBtnFunc' &gt;&lt;i style='color: #666666' class='fa fa-pencil fa-fw fa-2x'&gt;&lt;/i&gt;&lt;/a&gt;&lt;a href='#' id='deleteBtn'&gt;&lt;i style='color: #ff0000' class='fa fa-times fa-fw fa-2x'&gt;&lt;/i&gt;&lt;/a&gt;",
                          "targets": -1
                      }
                  ],*/
                  'fnServerData'   : function(sSource, aoData, fnCallback){
                      $.ajax ({
                          'dataType': 'json',
                          'type'    : 'POST',
                          'url'     : sSource,
                          'data'    : aoData,
                          'success' : fnCallback
                      }); //end of ajax
                  },
                  'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
                      $(nRow).attr("data-id",aData[0]);
                      return nRow;
                  }
              });
  
              //Edit Button on Modal Window
              $('#ManageForms').on('click', '.editBtnFunc', function(e){
                  e.preventDefault();
              var FormID = $(this).find('data-item').value();
              console.log(FormID);
              });
              //Edit Button
          } );
  
  
      &lt;/script&gt;
  </code></pre>