Chumper / Datatable

This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
https://github.com/Chumper/Datatable
388 stars 153 forks source link

plug-in sorting date dd/mm/YYYY #138

Open carlituxman opened 10 years ago

carlituxman commented 10 years ago

I'm trying this plugin https://datatables.net/plug-ins/sorting/date-eu with server-side

I'd tested without chumper/Datatable and it works but with not work

carlituxman commented 10 years ago

the plugin sorting is for client-side, with server-side no works.

But the problem is still when ordering in server-side date with dd/mm/YYYY format

maybe need some callback function for define our ordering method in some fields

carlituxman commented 10 years ago

I solve this in fnDrawCallback:

using this:

for ( var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ ) { $campo = $('td:eq(4)', oSettings.aoData[ oSettings.aiDisplay[i] ].nTr );

            $val = $campo.html();
            var eu_date = $val.split('-');

            $campo.html(eu_date[2]+"/"+eu_date[1]+"/"+eu_date[0]);

}

where 4 is the number of field