I'm using the jQuery DataTables plugin, which is working really great so far. However my table is quite long so I want to repeat the headers every ~30 rows or so. I tried it and got this alert when I loaded the page:
DataTables warning: Unexpected number of TD elements. Expected 5230 and got 4980. DataTables does not support rowspan / colspan in the table body, and there must be one cell for each row/column combination.
I changed the cells to TD instead of TH but now they don't stay in place when sorting, for开发者_开发技巧 obvious reasons, they just get grouped together. Is there a way round this? DataTables allows custom parsers but I can't think of any way to make every n rows stay in the same position.
There is a fixed header add-on that works with datatables that you may be interested in.
I came up with a solution I think is quite cool: setting a tooltip for appropriate cells with the column title. Perhaps it is overkill, I have ~200 rows and 5 columns that need differentiating, so it's 1000 occurrences of title="ABC"
. But it works.
精彩评论