1

I am using Jquery Datatable in Asp.net Page. As we know that at bottom it shows message like "Showing 1 to 10 of 100" . But i am getting issue that whenever Page size is less than total records then at bottom i always get Message ""Showing 1 to 010 of 100". 0 is getting prefixed before End records. My code is as below

  var pagesize = jQuery('#hdpagesize').val();
       jQuery('#dyntable').dataTable({
            "sPaginationType": "full_numbers",
            "iDisplayLength": pagesize,
            "aaSortingFixed": [[0, 'asc']],
            "aoColumnDefs": [
      { 'bSortable': true, 'aTargets': [1] }
   ],
            "fnDrawCallback": function (oSettings) {
                jQuery.uniform.update();


            }


        });

1 Answer 1

1

I believe this is where iDisplayLength is being processed as a string as opposed to an integer.

Try using parseInt(pagesize, 10) and see what result is returned.

If that fixes the problem, then try and apply a server-side fix so that pagesize is processed and served as an integer.

Sign up to request clarification or add additional context in comments.

1 Comment

Always specify the appropriate radix when using parseInt(): parseInt(pagesize, 10). Otherwise, for example, '010' will be parsed as 8, and '090' will be parsed as 0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.