Pagination 'next previous' buttons fial but numbers work

Pagination 'next previous' buttons fial but numbers work

bfarkasbfarkas Posts: 181Questions: 48Answers: 0

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

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    There are lots of threads with that error. Start with this one:
    https://datatables.net/forums/discussion/51588

    Kevin

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Hmm, so far none of them have been the same. Thanks, will need to trace it down.

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    edited September 2020

    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

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0
    edited September 2020

    Yeah, its a simple table though, I think it looks fine:

    <table cellpadding="0" cellspacing="0" border="0" class="display hover" id="p200table" width="100%">
                    <thead>
                        <tr>
                            <th class="all"></th>
                            <th class="all">first name</th>
                            <th class="min-tablet-l">middle name</th>
                            <th class="all">last name</th>
                            <th class="all">nest</th>
                            <th class="min-tablet-l">home phone</th>
                            <th class="min-tablet-l">mobile phone</th>
                            <th class="min-tablet-l">work phone</th>
                            <th class="min-tablet-l">personal email</th>
                            <th class="min-tablet-l">work email</th>
                            <th class="min-tablet-l">preferred email type</th>
                            <th class="">date of birth</th>
                            <th class="min-tablet-l">gender</th>
                            <th class="min-tablet-l">street</th>
                            <th class="min-tablet-l">city</th>
                            <th class="min-tablet-l">state</th>
                            <th class="min-tablet-l">postal code</th>
                        </tr>
                    </thead>
                    <tbody>
                    <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <tr/>
                    </tbody>
                </table>
    
  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    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

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    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!

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    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

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    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?

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    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

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    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.

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    I copied your code into a test case and get this error:

    Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined

    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

This discussion has been closed.