Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Gunde

    (@gunde)

    Hi

    In the soucecode it’s like this:
    " 02 Jan 2103 "

    On the page it’s like this:
    "02 Jan 2103"

    Really weird.

    The scraper plug-in seems not to be updated any more so I’ll try the other one I found that’s up-to-date (but with out any functions).

    The .trim didn’t work, but thanks anyway.

    /Gunde

    Thread Starter Gunde

    (@gunde)

    Hi

    Well it works like a charm, sorting dd/mm/yy , dd/mmm/yyyy and dd/mm/yyyy.

    But turns out the WP scraper that I use creates blank spaces before and after the output, sow I can’t sort my list. I found another scraper that nearly does the job. (It don’t allow regex before output)
    Is it possible to run regex inside the table?

    /Gunde

    Thread Starter Gunde

    (@gunde)

    Hi Tobis

    I’ve managed to change the format: dd/mmm/yyyy (stil not sortable)

    I’ve look around datatables.net and found some code:

    // Override default implementation for date sorting
    jQuery.extend( jQuery.fn.dataTableExt.oSort, {
        "date-uk-pre": function ( a ) {
            var ukDatea = jQuery(a).text().split('-');
            if(ukDatea.length==2){
                var month = ukDatea[0];
            }else{
                month = ukDatea[1];
            }
            if(month=="jan" || month=="Jan"){month=01;}
            else if(month=="feb" || month=="Feb"){month=02;}
            else if(month=="mar" || month=="Mar"){month=03;}
            else if(month=="apr" || month=="Apr"){month=04;}
            else if(month=="may" || month=="May"){month=05;}
            else if(month=="jun" || month=="Jun"){month=06;}
            else if(month=="jul" || month=="Jul"){month=07;}
            else if(month=="aug" || month=="Aug"){month=08;}
            else if(month=="sep" || month=="Sep"){month=09;}
            else if(month=="oct" || month=="Oct"){month=10;}
            else if(month=="nov" || month=="Nov"){month=11;}
            else{month=12;}
            if(ukDatea.length==2){
                return (ukDatea[1] + month) * 1;
            }else{
                return (ukDatea[2] + month + ukDatea[0]) * 1;
            }
        },
    
        "date-uk-asc": function ( a, b ) {
            console.log(a+" "+b);
            return ((a < b) ? -1 : ((a > b) ? 1 : 0));
        },
    
        "date-uk-desc": function ( a, b ) {
            return ((a < b) ? 1 : ((a > b) ? -1 : 0));
        }
    });

    Link

    Is it possible to implement the code in the jQuery of the Tablepress sorting extention?!?

    /Gunde

    Thread Starter Gunde

    (@gunde)

    Hi

    Unfortunately I can’t (or I just can’t figure it out) switch the format because the date are all scraped from WP blogs “lastbuilddate”

    I’ll sleep on it..again

    Thx for the fast response

    /Gunde

Viewing 4 replies - 1 through 4 (of 4 total)