开发者

Alternative backcolor broken after sorting using jQuery datatable plugin

开发者 https://www.devze.com 2022-12-14 01:57 出处:网络
I am using the jquery datatable plugin. I have the following code that sets up alternative backcolor on an html table.

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

精彩评论

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