Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
add or remove column from db where datatables library is used in codecanyon codeigniter script

I am getting error in js when I am adding or removing column in controller. As I am getting data in Network, its mean bug is in js code.

Error

enabled:795 Uncaught TypeError: Cannot read properties of undefined (reading 'split') at jquery.dataTables.min.js:18

JS CODE

  $(document).ready(function () {
    var oTable = $('#dynamic-table').dataTable({
        "aaSorting": [[3, "asc"]],
        "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
        "iDisplayLength": <?=$settings->rows_per_page;?>,
        'bProcessing': true, 'bServerSide': true,
        'sAjaxSource': '<?php echo base_url(); ?>panel/customers/getAllCustomers/<?php echo $toggle_type;?>',
        'fnServerData': function (sSource, aoData, fnCallback) {
            aoData.push({
                "name": "<?php echo $this->security->get_csrf_token_name() ?>",
                "value": "<?php echo $this->security->get_csrf_hash() ?>"
            });
            $.ajax({'dataType': 'json', 'type': 'POST', 'url': sSource, 'data': aoData, 'success': fnCallback});
        }, 
        "aoColumns": [
        null,
        null,
        null,
        null,
        {mRender: tp},
        {mRender: actions},
                
        ],
       
    });
          
});

Controller:

    public function getAllCustomers($type = NULL)
     {
     $this->load->library('datatables');
     $this->datatables
        // ->where('id !=', 1)
        ->select('id, CONCAT(first_name, " ", last_name ) as name, company, address, email, 
     telephone, disable')
        ->from('clients');
    // if ($type === 'disabled') {
    //     $this->datatables->where('disable', 1);
    // } elseif($type === 'enabled') {
        $this->datatables->where('disable', 0);
    // }
    $this->datatables->where('(universal=1 OR store_id='.$this->activeStore.')', NUll, FALSE);

    $this->datatables->add_column('actions', "$1___$2", 'id, disable');
    $this->datatables->unset_column('id');
    $this->datatables->unset_column('disable');
    echo $this->datatables->generate();
   }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda