title: DataTables data replacement to multiple columns based on one's value
body: <p>I am trying to make a conditional statement which will replace data not only to the column that I target but also and on a second one based of selected target's value.</p>
  
  <pre><code> setTimeout(function() {
    $('#invoices-table').DataTable({
      responsive: true,
      columnDefs: [{ orderable: false, targets: [-1, -2, -3] }, {
        targets: 0, // statement is based on first column data
        render: function(data, type) {
          // if data in col0 is "1" then replace data in col0 and col5 (pay button)
          if (type == 'display' &amp;&amp; data == '1') {
            return [
              { data: '&lt;i class="fa fa-3 fa-check-circle-o datatable-paid-1"&gt;&lt;/i&gt;', target: 0 },
              { data: '&lt;button class="pay-btn btn btn-sm btn-success disabled"&gt;Paid&lt;/button&gt;', target: 5 }
            ]
          } else {
            return [
              { data: '&lt;i class="fa fa-3 fa-exclamation-circle datatable-paid-0"&gt;&lt;/i&gt;', target: 0 }
            ]
          }
        },
      }],
      "lengthMenu": [
        [100, 5, 25, 50, -1],
        [100, 5, 25, 50, "All"]
      ],
      dom: 'Bfrtip',
      initComplete: function() {
        var api = this.api();
        // my actions upon complete
      }
    });
   }, 1500); // delay is needed due to needed time of mySQL for passing results
  </code></pre>
  
  <blockquote>
    <p><a href="https://codepen.io/anon/pen/jmgBdv?editors=0010" rel="nofollow noreferrer">https://codepen.io/anon/pen/jmgBdv?editors=0010</a></p>
  </blockquote>
  
  <p><strong>EDIT</strong></p>
  
  <p>Updated code both on post and codepen due to wrong target numbers</p>