开发者

Jquery Tablesorter custom date

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜