sData undefined
sData undefined
I'm trying to add filtering to a complex table (see: http://www.ktlw.org/program_guide.asp), but get the error sData undefined. From the research I did, I found that this is probably because datatables is having trouble digesting my table. Is there a way to solve that? I'm willing to refractor the structure of the table, but I'd like to try to keep the ultimate presentation.
Thanks for the help.
Thanks for the help.
This discussion has been closed.
Replies
Thanks for the link - it always makes debugging much faster! The reason for the error is, as you say, DataTables having trouble with your table. The problem in this specific case is that you are using colspans in your table, which DataTabels does not support - sorry. The problem with colspans is that it effectively groups the rows that they span, and when doing sorting and filtering, there is no concept of grouping in DataTables (it could be implemented several different ways, and it's not clear what the "correct" way would be - and it wouldn't be correct for everyone...).
To be honest I'm not sure there is a way around this with DataTables - I was wondering if it would be possible to add the colspans dynamically, but I suspect that would cause all sorts of problems.
So I'm sorry to say that if you want to use DataTables, what you'll need to do is to drop the use of colspan and have individual rows.
This might still be workable for you as you could use colouring to "group" the rows visually. Also aaFixedSorting can be used to force which column should be sorted on first, and therefore effectively providing grouping. But just not with colspan...
Regards,
Allan