jquery tablesorter plugin - retain alternative row colors

前端 未结 6 1519
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 20:36

I took an html table that I am applying alternative row colors to, and I added jquery table sorter on it so users can sort the table.

The issue is that the alternati

6条回答
  •  感情败类
    2021-01-01 21:17

    There's already a default widget zebra, built into the core, which applies the classes odd and even to alternate rows. It works whether or not you have added class=even/odd to the html file.

    It's really easy to set up. I simply followed the instructions on the table sorter website, and then modified the document ready function to the following:

    
    

    I made an example while answering the question. You can view the result in action, or see the example code.

提交回复
热议问题