Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all,
I would like to list 10000 of data on page without paging, i want to use scrolling or button click to show more data on the same page without a postback.

when page loads for the first time it will show 100 data and when user click on button it will show next 100 and so on. ?
Posted

<script>      $(document).ready(function () {
          var itemsCount = 0,
    itemsMax = $('#maindiv div.col-sm-4').length;
          $('#maindiv div.col-sm-4').hide();

          function showNextItems() {
              var pagination = 3;

              for (var i =itemsCount; i < (itemsCount + pagination); i++) {
                  $('#maindiv div.col-sm-4:eq(' + i + ')').show();
              }

              itemsCount += pagination;

              if (itemsCount > itemsMax) {
                  $('#showMore').hide();
              }
          };

          showNextItems();

          $('#showMore').on('click', function (e) {
              e.preventDefault();
              showNextItems();
          });
      });</script>


<a href="#" id="showMore">Show More</a>
 
Share this answer
 
v2
plz check these

lazy loading[^]

lazy loading[^]
 
Share this answer
 
Comments
ravikhoda 3-Jan-14 4:11am    
Thanks for your solution
Naz_Firdouse 3-Jan-14 4:13am    
mark as answer so that it will be helpful to others

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900