Pagination 'next previous' buttons fial but numbers work
Pagination 'next previous' buttons fial but numbers work
I'm seeing a console error of:
Uncaught TypeError: Cannot read property 'nTr' of undefined
at x.<anonymous> (datatables.min.js:177)
at x.iterator (datatables.min.js:163)
at x.<anonymous> (datatables.min.js:177)
at x.nodes (datatables.min.js:165)
at m._resizeAuto (datatables.min.js:564)
at HTMLTableElement.<anonymous> (datatables.min.js:552)
at HTMLTableElement.dispatch (datatables.min.js:14)
at HTMLTableElement.y.handle (datatables.min.js:14)
at Object.trigger (datatables.min.js:14)
at HTMLTableElement.<anonymous> (datatables.min.js:14)
When i try to use the next/previous button on pagination. If i click a number directly it works fine. Anyone run into before?
Answers
There are lots of threads with that error. Start with this one:
https://datatables.net/forums/discussion/51588
Kevin
Hmm, so far none of them have been the same. Thanks, will need to trace it down.
Basically I think it boils down to an HTML issue. Make sure your table meets these HTML requirements. It could be a particular row.
Kevin
Yeah, its a simple table though, I think it looks fine:
How are you adding rows?
Inspect the table when you get the error.
Can you post a link to your page or a test case replicating the problem?
Kevin
Just the editor managing the table to add rows.
I will when I can, they are doing maintenance on my server currently. Thanks for looking though!
You are starting with a table that has one blank row then using the Editor to add rows?
Are you doing something to remove the empty row?
Kevin
No, I actually didn’t have that row until today to see if it fixed it.
It was the same problem either way.
Do I need to just eliminate the header and row if blank table to start?
A header is needed. You either need to provide it in HTML or use
columns.title to have Datatables build the header. The
-tag tbodyand everything inside is not needed. Datatables will add the
-tag tbody`.Are you seeing the error with an empty table? The next and previous buttons shouldn't be active in this case.
Kevin
So until today I had just the header and saw the error. When I have under 50 entries it is not active as that’s what I have the paging set to.
I copied your code into a test case and get this error:
The above code does have on error. Line 42 has
<tr/>
but it</tr>
.If I understand correctly you see the error with a blank table or just that one empty row when clicking next or previous. Is that correct?
This test case doesn't have that problem.
http://live.datatables.net/zihuxuqi/1/edit
I guess I'm not clear on when you are seeing the error. Maybe we should wait until you can provide a test case and provide the steps to recreate the error.
Kevin