pagination issue when selecting all (-1) - last item class is failing to be disabled

pagination issue when selecting all (-1) - last item class is failing to be disabled

kmcadamskmcadams Posts: 4Questions: 0Answers: 0
edited January 2013 in Plug-ins
when selecting all from the pagination drop down, value -1, the li.last list item is failing to past the test to add the class "disabled."


Lets say the list is 37 items long. When I debug the line of code
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {

the values for oPaging.iTotalPages === -37

local values :
iEnd : -37


oPaging Object
oPaging.iEnd : 37,
oPaging.iFilteredTotal: 37
oPaging.iLength: -1
oPaging.iPage: 0,
oPaging.iStart: 0,
oPaging.iTotal: 37,
iTotalPages: -37

the disabling of the class works as expected when selecting all other values and when searching and returning zero search results

Can anyone suggest a fix for this bug?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Can you link to a test case showing this issue please? I've just being looking at this by putting this test case together: http://live.datatables.net/exuzop/edit#javascript,html - but it appears to work as expected fro me.

    Allan
  • kmcadamskmcadams Posts: 4Questions: 0Answers: 0
    edited January 2013
    it doesnt look like this example is using the pagination example - http://datatables.net/plug-ins/pagination - line 82 in the pagination function is failing when the dropdown selection is -1 "all"

    // Add / remove disabled classes from the static elements

    when i inspect the oSetting object, the iTotalPages value is -37 which in this case its the negative values of all records, 37
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    There are 6 plug-ins on that page - are you having problems with one of them, rather than the built-in pagination, as I had assumed from your original post? Can you please link to a test case showing the issue?

    Allan
  • kmcadamskmcadams Posts: 4Questions: 0Answers: 0
    edited January 2013
    I work on a test case and yes, I am having an issue with one of the plugins, not the built in pagination. The one I am using is the twitter bootstrap version.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    It is possible (but I'm not sure - haven't checked yet!) that the Bootstrap plug-in on this site is a little out of date. Try using the integration files here: https://github.com/DataTables/Plugins/tree/master/integration/bootstrap .

    Allan
  • kmcadamskmcadams Posts: 4Questions: 0Answers: 0
    edited January 2013
    The code I have is the same as that is in master - I cant create a test in jsbin with the correct default settings

    /* Set the defaults for DataTables initialisation */
    $.extend( true, $.fn.dataTable.defaults, {
    'iDisplayLength' : 15,
    'aLengthMenu': [[10, 15, 25, 50, -1], [10, 15, 25, 50, "All"]],
    // bootstrap pagination from http://datatables.net/media/blog/bootstrap_2/DT_bootstrap.js
    'sDom': "TRrt<'table-controls'<'pull-left'l><'pull-right'ip>>",
    'sPaginationType': 'bootstrap'
    }
    );


    however if you go to http://datatables.net/media/blog/bootstrap_2/ and edit the pages html drop down and replace the last drop down option with -1 and "all" you can recreate the bug. Next will be blue and not have the disabled class added to "next"
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    edited January 2013
    Great - thanks for describing how I could reproduce the issue. The error was in the fnPagingInfo plug-in for which I've just committed a fix. I've also updated the bootstrap integration code.

    Thanks for flagging this up.

    Regards,
    Allan
This discussion has been closed.