开发者

Zebra widget doesn't work, if i have a child table?

I have a problems with the JQuery tablesorter plugin.

I use "zebra" widget, but it doesn't work if i have another table in the main table.

$("#selection_table").tablesorter(
     {
    开发者_运维知识库      widgets: ['zebra']
        })

if i have another table somewhere in the selection_table, zebra widget stop working properly.

Is there a way to fix such behavior?

Thanks much


Not sure what you can do here, the code isn't correct, here's the widget:

ts.addWidget({
    id: "zebra",
    format: function(table) {
        if (table.config.debug) {
            var time = new Date();
        }
        $("tr:visible", table.tBodies[0]).filter(':even').removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(':odd').removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);
        if (table.config.debug) {
            $.tablesorter.benchmark("Applying Zebra widget", time);
        }
    }
});

that $("tr:visible", table.tBodies[0]) should be: $(table.tBodies[0]).children("tr:visible") to do odd/even correctly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜