• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to set total no of records in ajax jquery call?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am using jquery datatable for pagination. Using Jquery+ajax+Spring for this page.
From my jsp page I am giving ajax call to Spring controller, fetching data & data getting displayed for 1st page as shown below:

"success": function (data) {
      var tab1 = $("#example").DataTable();            
          $.each(data, function(i, item) {          
                                 //Setting data to datatable
          });
      }

There are total 37 records in datatable & I am showing 10 records per page so datatable should be showing 4 pages.
At present, only 1 page (first page) is getting displayed  as I am retrieving 10 rows from db & have not set total count.
My question is -:
- How to set total no of records to this datatable in above code so that pagination will work & will display 4 pages?
- When I am trying to set recordsTotal in datatable its giving error "Can not reinitialise datatable".

Regards,
Amita




 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic