title: Get row id of a table row after selecting a row and clicking the button in datatables
body: <p>What I want to achieve is to display a table and after selecting a row, make it possible to edit or delete a row (make a proper query) so I need a primary key which I don't want to display. My table looks like this:</p>
  
  <pre><code>&lt;table id='documents_d' class='display'&gt;
      &lt;thead&gt;
          &lt;tr&gt;&lt;th&gt;title 1&lt;/th&gt;&lt;th&gt;title 2&lt;/th&gt;&lt;th&gt;title 3&lt;/th&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr data-id='1'&gt;
              &lt;td&gt;content&lt;/td&gt;
              &lt;td&gt;content&lt;/td&gt;
              &lt;td&gt;content&lt;/td&gt;
          &lt;tr data-id='2'&gt;
              &lt;td&gt;content&lt;/td&gt;
              &lt;td&gt;content&lt;/td&gt;
              &lt;td&gt;content&lt;/td&gt;&lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I use the following script to get the datatables running:</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function () {
          var documents_d = $('#documents_d').DataTable({
              paging: true,
              dom: 'Blfrtip',
              colReorder: true,
              select: {style: 'single'},
              rowId: 'Writer',
              buttons: [
                  'colvis',
                  'excelHtml5',
                  {
                      text: 'Edit',
                      action: function () {
                          alert(documents_d.row('.selected').data());
                      }
                  }
              ]
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Instead of an alert I want to run a function like editDocument($docID). So first I want to select a row (this is working fine) and after clicking 'Edit' I want to get the 'data-id' and run a function. I tried:</p>
  
  <pre><code>documents_d.row('.selected').data("data-id")
  </code></pre>
  
  <p>but this would give me an error:</p>
  
  <blockquote>
    <p>DataTables warning: table id=documents_d - Requested unknown parameter
    '7' for row 1, column 7. For more information about this error, please
    see <a href="http://datatables.net/tn/4" rel="nofollow">http://datatables.net/tn/4</a></p>
  </blockquote>