title: how can I validate inside datatable for status column?
body: <p>I want to validate if status == 1 then display active span if not display inactive status , but how can I do it with datatables I try it this with jquery ajax without datatables  <code>status = (Data[i][5] == 1)  ? "&lt;span class='label label-success'&gt;active&lt;/span&gt;":"&lt;span class='label label-danger'&gt;inactive&lt;/span&gt;";</code></p>
  
  <p>controller</p>
  
  <pre><code>public function datatable(){
          $array = $this-&gt;products-&gt;datatable();
          $this-&gt;json($array);
          $data = array();
          foreach ($array as $rows){
              array_push($data, array(
                  $rows['id'],
                  $rows['descripcion'],
                  $rows['precio_compra'],
                  $rows['precio_venta'],
                  $rows['precio_mayoreo'],    
                  $rows['existencia'],
                  $rows['status']
              ));
          }
          $this-&gt;json(array('data' =&gt; $data));
      }
  </code></pre>
  
  <p>ajax</p>
  
  <pre><code>var table = $('#example').DataTable({
          "lengthChange": false,
          ajax: {
              url: URL_GET_DATATABLE,
              type: 'POST',
          },
          columnDefs:[{
              targets: -1,
              data: null,
              defaultContent: "&lt;button&gt;Click!&lt;/button&gt;"
          }],
      });
  </code></pre>
  
  <p>how can I validate change that one for span text?? </p>
  
  <p><a href="https://i.stack.imgur.com/g2F78.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g2F78.png" alt="datatable"></a></p>