Datatable icon indicating copy to clipboard operation
Datatable copied to clipboard

plug-in sorting date dd/mm/YYYY

Open carlituxman opened this issue 11 years ago • 2 comments

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 avatar Jul 15 '14 18:07 carlituxman

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 avatar Jul 16 '14 11:07 carlituxman

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

carlituxman avatar Jul 16 '14 11:07 carlituxman