Page Number not showing on select "ALL" from dropdown

Page Number not showing on select "ALL" from dropdown

pankajnpatelpankajnpatel Posts: 4Questions: 0Answers: 0
edited March 2012 in General
Datatable not showing page number while I select option "ALL" from dropdown...
I have added below option with Datatable.
$('#myTable').dataTable(
{
"bAutoWidth":false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"bInfo": false,
"bFilter": true,
"bSort": true,
"sScrollX": "100%",
"sScrollXInner": "150%",
"sScrollY": "230",
"bLengthChange": true,
"sDom": 'rt<"bottom"p>',
"iDisplayLength": 10,
"bProcessing": true,
"oLanguage": {
"sSearch": "Search within results:"
},
"aLengthMenu": [[10, 20, 40, 80, 160, -1] , ["10/page", "20/page", "40/page", "80/page", "160/page" , "All"]],
"fnDrawCallback": function ( oSettings ) {
if (this.parent().find("div.paging_full_numbers").find('span:not([class])').text() == '' ){
this.parent().find("div.paging_full_numbers").find('span:not([class])').html("1");
}
}
});

In above configuration I have added "fnDrawCallback" to display page "1" number in pagination.... When I remove scroll option from above configuration then it display "1" pagenumber.

Also why its not displaying page number "1" when I select "ALL" option from dropdown?

Any one can help me to resolve this problem?

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    I'd suggest perhaps using this API plug-in to determine the paging state rather than looking at DOM parameters: http://datatables.net/plug-ins/api#fnPagingInfo . However, given that you are manipulating the paging control, I'm just wondering if something is breaking somewhere as a result of the manipulation. It might be an idea to pull that logic into a paging plug-in rather than trying to manipulate the DOM which is under control of a different part of the script.

    Allan
  • pankajnpatelpankajnpatel Posts: 4Questions: 0Answers: 0
    Actually i am getting confusion here....
    When I select length from dropdown like 10,20,40..... its working fine and pagination control also displaying page numbers....
    But when I select "ALL" from dropdown then its not displaying default selected page "1".
    Could you please help me to resolve this issue and how will be useful the fnPagingInfo to solve this?
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    This looks like a bug in DataTables - I'll look at this very shortly.

    Allan
  • pankajnpatelpankajnpatel Posts: 4Questions: 0Answers: 0
    Hi allan,

    I have added below condition in my jquery datatable js file. It working fine now for me....
    Before changes :
    iEndButton = iPages;

    After changes :
    iEndButton = (iPages) < 0 ? 1 : (iPages);

    I have updated this code in function "fnUpdate" @ line# 449. I am getting this issue only if I use "sScrollX" & "sScrollY"

    * File: jquery.dataTables.js
    * Version: 1.8.2
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    I've just updated DataTables to address this bug - the 1.9.1.dev version available on the downloads page ( http://datatables.net/download ) now includes this fix and the next release, 1.9.1, will include the fix.

    Thanks for flagging this up!

    Allan
  • pankajnpatelpankajnpatel Posts: 4Questions: 0Answers: 0
    Hi Allan,

    I have used table control on many pages in my current application and this application is on final stage. It's suitable to use new version right now because of some minor changes can be make more QA work.....

    Could you please tell me those changes if possible? So I can add it in existing used datatable version. Because of version 1.8.2 is working fine for me.....
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    This is the change I committed: https://github.com/DataTables/DataTables/commit/e815062197c87328c25d37a440a785d1156b8b19 . However, the internal paging methods were more or less rewritten for 1.9 so you might need to port my change back a little bit (although I doubt it will be that different).

    Allan
This discussion has been closed.