i want to sort date but date column sorting on string where to set type:date in my code

i want to sort date but date column sorting on string where to set type:date in my code

Propix_311Propix_311 Posts: 5Questions: 2Answers: 0

$.extend( _ext.type.order, {
// Dates

       "date-pre": function (d) {
       return Datetime.parse(d) || 0;

        //"date-pre": function ( a ) {
        //    var ukDatea = a.split('/');
        //       return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;

    },

    "date-asc": function ( a, b ) {
        return ((a < b) ? -1 : ((a > b) ? 1 : 0));

    },

    "date-desc": function ( a, b ) {
        return ((a < b) ? 1 : ((a > b) ? -1 : 0));
    },

    // html
    "html-pre": function ( a ) {
        return _empty(a) ?
            '' :
            a.replace ?
                a.replace( /<.*?>/g, "" ).toLowerCase() :
                a+'';
    },

    // string
    "string-pre": function ( a ) {
        // This is a little complex, but faster than always calling toString,
        // http://jsperf.com/tostring-v-check
        return _empty(a) ?
            '' :
            typeof a === 'string' ?
                a.toLowerCase() :
                ! a.toString ?
                    '' :
                    a.toString();
    },

    // string-asc and -desc are retained only for compatibility with the old
    // sort methods
    "string-asc": function ( x, y ) {
        return ((x < y) ? -1 : ((x > y) ? 1 : 0));
    },

    "string-desc": function ( x, y ) {
        return ((x < y) ? 1 : ((x > y) ? -1 : 0));
    }

});

Answers

This discussion has been closed.