Not logged in - Login
< back

jQuery Datatables



  $("#tablepress-12 thead tr th.column-1").addClass("no-sort");
        $("#tablepress-12 thead tr th.column-2").addClass("no-sort");
        $("#tablepress-12 thead tr th.column-8").addClass("no-sort");

        jQuery.extend( jQuery.fn.dataTableExt.oSort, {
            "formatted-num-pre": function ( a ) {
                a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" );
                return parseFloat( a );
            },

            "formatted-num-asc": function ( a, b ) {
                return a - b;
            },

            "formatted-num-desc": function ( a, b ) {
                return b - a;
            }
        } );
        jQuery.extend( jQuery.fn.dataTableExt.oSort, {
            "currency-pre": function ( a ) {
                a = (a==="-") ? 0 : a.replace( /[^\d\-\.]/g, "" );
                return parseFloat( a );
            },

            "currency-asc": function ( a, b ) {
                return a - b;
            },

            "currency-desc": function ( a, b ) {
                return b - a;
            }
        } );



        $('.data-table-sort').dataTable({
            "aoColumns": [
                null,
                null,
                null,
                { "sType": "formatted-num" },
                null,
                null,
                null,
                null
            ],"aoColumnDefs": [
                { 'bSortable': false, 'aTargets': ["no-sort" ] }
            ]
        });