0

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.

2
  • Wouldn't it be better just to paginate the results? Or does that not work for your implementation? Commented Jun 5, 2010 at 0:28
  • @edl: Hmm, I suppose pagination isn't too bad. With the filter and everything it makes it easier for searching and so on. Commented Jun 7, 2010 at 10:38

2 Answers 2

3

There is a fixed header add-on that works with datatables that you may be interested in.

Sign up to request clarification or add additional context in comments.

1 Comment

Excellent, that works (almost) perfectly! There's a small problem if you add/remove columns or the table moves slightly, but can be worked around by calling the fixedHeader.fnUpdate() method.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.