ColReorder and index in server-side processing

ColReorder and index in server-side processing

kris40kris40 Posts: 7Questions: 2Answers: 0

Hi,

i've got problem searching values in server side processing because index are bad after moving columns. Here is is my js code :

var dataTable = $('#test').DataTable( {
...

"aoColumnDefs": [
{ "sName": "client", "aTargets": [ 0 ] },
{ "sName": "id", "aTargets": [ 1 ] },
{ "sName": "date", "aTargets": [ 2 ] },
{ "sName": "nom", "aTargets": [ 3 ] },

                      ],

});
dataTable.columns().every( function () {
var that = this;

                    $( 'input', this.footer() ).on( 'keyup change', function () {
                        if ( that.search() !== this.value ) {
                            that
                                .search( this.value )
                                .draw();

                        }

                    } );
                } );

new $.fn.dataTable.ColReorder( dataTable, {
// options
} );

and my php code (the search part of sql) :
$sql.=" AND " . $requestData['columns'][$column_nb]['name'] . " LIKE '%" . $requestData['columns'][$column_nb]['search']['value'] . "%' ";

$requestData['columns'][$column_nb]['name'] returns bad column index after moving, and i without knowing a little bit of javascript it's a little hard for me...someone see what's wrong ?
Thanks

This discussion has been closed.