开发者

Alternative backcolor broken after sorting using jQuery datatable plugin

I am using the jquery datatable plugin. I have the following code that sets up alternative backcolor on an html table.

$('#dependenciesTabletr:odd td').addClass('odd');
$('#dependenciesTabletr:even td').addClass('even');

$('#dependenciesTable').dataTable({
    "bPaginate": false,
    "aaSorting": [[2, "desc"]],
    "bJQueryUI": false,
    "bSortClasses": false,
    "oLan开发者_JAVA百科guage": {
        "sSearch": "Filter:"
    },
    "bSort": true
});

The issue is after I sort the alternative backcolor is broken. is there anyway to reset this after each sort ?


Edit the css for this?

table.display tr.odd.gradeA {
    background-color: #ddffdd;
}

table.display tr.even.gradeA {
    background-color: #eeffee;
}


hmm but take a look at this example this plugin provides the odd/even selectors outofthebox you don't need to bind them.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜