开发者

Jquery Tablesorter custom date

开发者 https://www.devze.com 2022-12-11 21:09 出处:网络
I\'m trying to setu开发者_JS百科p a custom date parser but can\'t get my head around it. Basically my dates are in the format mm/yyyy.

I'm trying to setu开发者_JS百科p a custom date parser but can't get my head around it. Basically my dates are in the format mm/yyyy.

Can anyone point me in the right direction?

Thanks


        $.tablesorter.addParser({ 
            id: 'date_ger', 
            is: function(s) { 
                return false; 
            }, 
            format: function(s) { 
                var res = s.split('/');
                return res[1]+res[0];
            },
            type: 'numeric' 
        }); 

And use it like this for the third column:

        $(document).ready(function() {
            $("#tableinfi").tablesorter({ 
                headers: {
                    2: {
                        sorter:'date_ger',
                    }
                } 
            }); 
0

精彩评论

暂无评论...
验证码 换一张
取 消