when I use pagination and click on the data present on the last page it brings me first page why?

when I use pagination and click on the data present on the last page it brings me first page why?

praphullapraphulla Posts: 13Questions: 5Answers: 0

I have used bootrap datatable and I load the data in it once there will more than one pagination and I click on the other page it brings me on the first page why this is happening I am not able to understand?

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Please provide a link to a test page showing the issue.

  • praphullapraphulla Posts: 13Questions: 5Answers: 0

    I have attached image here you can see there are 1 and 2 pages when i click on 2 page data is loaded as like which displays on 1 page but once i click on any row it navigates me to the page 1.

  • praphullapraphulla Posts: 13Questions: 5Answers: 0

    I think see this one.

    var table = $('#'+detailDataTableReportName).DataTable({
    "bProcessing": false,
    "bServerSide": false,
    "aoColumns": detailColumnNames,
    "data": response.rows,
    "bJQueryUI": false,
    "bFilter": false,
    "dom": 'rt<"bottom"flp> ',
    "bSort":false,
    "order": [[ order, 'asc' ]],
    "aLengthMenu": [ 24 ],
    "iDisplayLength": 24,

            "preDrawCallback": function( settings ) {
                flagForDrawback = false;
              },            
            "drawCallback": function ( settings ) {
                var api = this.api();
                var rows = api.rows( {page:'current'} ).nodes();
                var last=null;
    
                if(flagForDrawback == false)
                {
    
                    api.column(order, {page:'current'} ).data().each( function ( group, i ) {
                        if ( last !== group ) 
                        {
                                flagForDrawback = true;
                                $(rows).eq( i ).before(
                                    '<tr class="group"><td colspan="'+colspan+'"><b>'+group+'</b></td></tr>'
                                );
                                last = group;
                        } 
                    } );
    
                }   
            },
            "fnInitComplete" : function(oSettings, json) {
                flagForDrawback = false;
                if ($("#"+detailDataTableReportName).dataTable().fnSettings().aoData.length == 0) {
    
                }else {
                    console.log("Going to stop here...!!!");
                }
    
            }
    
        });
    
        // Order by the grouping
        $('#'+detailDataTableReportName+' tbody').unbind('click').bind( 'click', 'tr.group', function () {
            var currentOrder = $('#'+detailDataTableReportName).DataTable().table().order()[0];//table.order()[0];
            if ( currentOrder[0] === order && currentOrder[1] === 'asc' ) {
    
                $('#'+detailDataTableReportName).DataTable().table().order( [ order, 'desc' ] ).draw();//
    
            }
            else {
    
                $('#'+detailDataTableReportName).DataTable().table().order( [ order, 'asc' ] ).draw();
    
            }
    
        } );
    
  • allanallan Posts: 64,894Questions: 1Answers: 10,747 Site admin

    We'd need a link to a page showing the issue as tangerine requested.

    Allan

  • praphullapraphulla Posts: 13Questions: 5Answers: 0
    edited May 2017

    I am sorry allan but the people with whom i am working they will not allow me to send the link.

  • allanallan Posts: 64,894Questions: 1Answers: 10,747 Site admin
    Answer ✓

    I'm afraid there is little help we can offer then. If you can create an example showing the issue on JSFiddle or http://live.datatables.net we could look into that.

    Allan

  • praphullapraphulla Posts: 13Questions: 5Answers: 0
    edited May 2017

    Allan thank you very much for your help. got the solution . once I will be any issue , back to you soon.

This discussion has been closed.