开发者

jQuery table data sorter plugin for tables with multiple <th> rows

开发者 https://www.devze.com 2023-03-15 09:35 出处:网络
I have a set of tables in a build that use the Tablesorter 2.0 jQuery plugin to sort columns of data. It works perfectly fine until I get to a more complex table that has multiple TH rows.

I have a set of tables in a build that use the Tablesorter 2.0 jQuery plugin to sort columns of data. It works perfectly fine until I get to a more complex table that has multiple TH rows.

Tablesorter 2.0 automatically detects the first set of THs and makes them the sorting trigger. There's no way to override this with a selector.

My complex table has multiple TBODYs with rows of THs on top like so:

jQuery table data sorter plugin for tables with multiple <th> rows

I'm going to give www.datatables.net a go to see if it has a way around this but I'm worried I could run into JS conflicts with both plugins running on the site.

Any other suggestions of how to achieve table sorting within each TBODY using the row where you see 'My 开发者_如何学GoEquity' as the sort headers NOT the dark grey header row at the top?

An example of the source HTML is here: http://pastebin.com/CYd06L87


Datatables is a very powerful grid sorter and you should have no problem using multiple TH's. They also have solutions for table details, which might be an alternate way to approach this task. For example, you could have two main rows, one for your equity and one for your equity, all in the same table. Then, setup row details to accomplish your goal...just one possibility.

Here's the row details tut: http://datatables.net/release-datatables/examples/server_side/row_details.html

There's also a solution for summing row totals.

0

精彩评论

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

关注公众号