My data table has two pages but on first load it shows only page number 1 not showing page number 2.

My data table has two pages but on first load it shows only page number 1 not showing page number 2.

uthaya92uthaya92 Posts: 3Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: My data table has two pages but on first load it shows only page number 1 not showing page number 2. After clicking on next page it shows 2 and 1 for selection.

Answers

  • kthorngrenkthorngren Posts: 21,351Questions: 26Answers: 4,955

    Its hard to say what the problem is with just a screenshot. Start by posting your Datatables initialization code. Better is a link to your page or test case replicating the issue so we can help debug.
    https://www.datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • uthaya92uthaya92 Posts: 3Questions: 1Answers: 0
    edited March 25

    Data table initialization .

    $('#team-data-table').dataTable( {
                "paging" : $('#team-data-table tbody tr').length>10,
                "pageLength":10,
                "iDisplayLength": 10,
                "sPaginationType": "four_button",
                 pagingType: 'full_numbers',
                "oLanguage": {
                    "sZeroRecords": "@_LocalizedAll["Searched team is not found"]",
                    "sSearchPlaceholder": "@_LocalizedAll["Search for a team"]"
                },
                "paginate": {
                    "next": "Next",
                    "previous": "Previous"
                },
                "fnDrawCallback": function(oSettings) {
                    $("#team-data-table input[type=radio][value!="+selection+"]").prop('checked', false);
                }
    
            });
    

    Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

  • uthaya92uthaya92 Posts: 3Questions: 1Answers: 0
    edited March 25

    HTML Code:

    <div class="paginated-team-section">
                                                        @{
                                                            <table id="team-data-table">
                                                                <thead>
                                                                    <tr>
                                                                        <td>Name</td>
                                                                    </tr>
                                                                </thead>
                                                                <tbody>
                                                                    @foreach (var team in Model.Teams)
                                                                {
                                                                    if (!(DateTime.Now > Model.SelectedChallenge.EnrollByDate.Value && team.MemberCount < Model.SelectedChallenge.MinMembersPerTeam))
                                                                    {
                                                                        <tr class="team-name-layer">
    <td></td>
                                                                            </tr>
                                                                    }
                                                                }
                                                                </tbody>
                                                            </table>
    
                                                        }
                                                    </div>
    

    Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

  • kthorngrenkthorngren Posts: 21,351Questions: 26Answers: 4,955

    There is nothing obvious in the Datatables init code. I'm not sure what the table will look like from the HTML code. My first troubleshooting step would be to comment out the Datatables init code and use the browser's inspect tool to view the resulting table. If you don't see any issues then copy the table to build a test case. Go to https://live.datatables.net/ and replace the existing table with the copied one.

    Is the same behavior seen?

    Post a link to the test case you just built.

    Kevin

Sign In or Register to comment.