title: DataTables how to fill a column with a hyperlink?
body: <p>I am using DataTables server-side processing and would like to add a hyperlink in the first cell of some of the tables. </p>
  
  <p>I am able to add a column and have the table render correctly, but I can't figure out how to get a hyperlink into the cell. </p>
  
  <p>I don't want this in every table, right now it's just going to be for two of them, but that is subject to change.</p>
  
  <p>I use the same initialization for all of my tables, but all the tables do not have the same columns. There could be anywhere from 3 to 65 columns depending on what table I'm rendering so I can't just add the columns into the initialization. Here is how I'm initializing right now:</p>
  
  <pre><code>$(document).ready(function ()
  {
      // Setup - add a text input to each footer cell
      $('#DataTable tfoot th').each(function ()
      {
          var title = $(this).text();
          $(this).html('&lt;input type="text" placeholder="Search ' + title + '" /&gt;');
      });
  
      var table = $('#DataTable').DataTable({
          "lengthMenu": [[25, 50, 75, 100, 150, -1], [25, 50, 75, 100, 150, 'All']],
          "dom": '&lt;"top"Bifpl&lt;"clear"&gt;&gt;rt&lt;"bottom"ip&lt;"clear"&gt;&gt;',
          "buttons": [{
              extend: 'collection',
              text: 'Selection',
              buttons: ['selectAll', 'selectNone']
          }, {
              extend: 'collection',
              text: 'Export',
              buttons: ['export', 'excel', 'csv', 'pdf', { extend: 'excel',
                  text: 'Export Current Page',
                  exportOptions: {
                      modifier: {
                          page: 'current'
                      }
                  },
                  customize: function (xlsx)
                  {
                      var sheet = xlsx.xl.worksheets['sheet1.xml'];
                      $('row:first c', sheet).attr('s', '7');
                  }
              },
  
              {
                  text: 'Export All to Excel',
                  action: function (e, dt, button, config)
                  {
                      dt.one('preXhr', function (e, s, data)
                      {
                          data.length = -1;
                      }).one('draw', function (e, settings, json, xhr)
                      {
                          var excelButtonConfig = $.fn.DataTable.ext.buttons.excelHtml5;
                          var addOptions = { exportOptions: { 'columns': ':all'} };
  
                          $.extend(true, excelButtonConfig, addOptions);
                          excelButtonConfig.action(e, dt, button, excelButtonConfig);
                      }).draw();
                  }
              }]
          }
          ],
          "fixedHeader": {
              header: true,
              footer: true
          },
          "select": true,
          "processing": true,
          "serverSide": true,
          "ajax": {
              "url": "./ServerSide.php",
              "type": "POST"
          },
  //Added this to the initialization
          columnDefs: [
          {
              targets: 0,
              render: function (data, type, row, meta)
              {
                  if (type === 'display')
                  {
                      data = '&lt;a href="FormToEdit.php?everything=' + encodeURIComponent(row) + '"&gt;' + data + '&lt;/a&gt;';
                  }
                  return data;
              }
          }],
  //It adds the hyperlink to all tables and not just the ones that I want
          initComplete: function ()
          {
              var api = this.api();
  
              // Apply the search
              api.columns().every(function ()
              {
                  var that = this;
  
                  $('input', this.footer()).on('keyup change', function ()
                  {
                      if (that.search() !== this.value)
                      {
                          that
                            .search(this.value)
                            .draw();
                      }
                  });
              });
          }
      });
  });
  </code></pre>
  
  <p>Here's how I create the tables:</p>
  
  <pre><code>&lt;?php
      $hsql = "select Headings from TableHeadings where TableName = '$TableName' order by Id";
  
      $getHeadings = $conn-&gt;query($hsql);
      $rHeadings = $getHeadings-&gt;fetchALL(PDO::FETCH_ASSOC);
      $CountHeadings = count($rHeadings);
      $tsqlHeadings = '';
      for ($row = 0; $row &lt; $CountHeadings; $row++)
      {
          $headings[$row] = $rHeadings[$row]["Headings"];
      }
  ?&gt;
  &lt;table id="DataTable" class="display nowrap" style="width: 100%; border: 1px"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;?php
              foreach($headings as $heading)
              {?&gt;
              &lt;th class="cell"&gt;&lt;?php echo $heading; ?&gt;&lt;/th&gt;&lt;?php
              }?&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tfoot&gt;
          &lt;tr&gt;
              &lt;?php
              foreach($headings as $heading)
              {?&gt;
              &lt;th class="cell"&gt;&lt;?php echo $heading; ?&gt;&lt;/th&gt;&lt;?php
              }?&gt;
          &lt;/tr&gt;
      &lt;/tfoot&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have edited the initialization script above with what I've added. The problem now is that it adds this hyperlink to all tables and not just to the ones that have the <strong>Edit</strong> column. How would I modify this further to get it only on the table if the first column header is <strong>Edit</strong>?</p>