0

I am fetching huge set of data to display in ngTable at a time , but i want to fetch data by making service call on each page click rather than fetching it at once .

I have tried to do that by modifying code in the library making service call on each page click and assign the new data set to the ngTable param , but each time I assign new data the pagination is made according to the current data length , which should on the base of total records present in the DB

Thnaks

  • Send `total length of data` through _api_ and set total value. You do this by calling `NgTableParams.total()`. Refer http://codepen.io/christianacca/pen/mJoGPE (From documentation) – Rayon Dec 14 '15 at 05:33
  • it will help you--> http://stackoverflow.com/questions/21805734/loading-json-via-ajax-with-ngtable-parameters – skmahawar Dec 14 '15 at 05:48
  • NgTableParams.total(data.length) helps to populate the page numbers only , but this won`t load data of individual page on api call – Rajendra kumar sahoo Dec 14 '15 at 06:04
  • You can bind event to page numbers and then update the data in `tableParams` after making api call.. – Rayon Dec 14 '15 at 06:56
  • @RayonDabre i have already tried it , but when ever i update the data on page click data starts inserting from the first page itself not in the current page only. For example if i click on the page 2 and total records fetched 10 , where the page count is 10 then this records are placed in the first page itself and no records showing in the 2nd page – Rajendra kumar sahoo Dec 14 '15 at 07:48
  • You need to update your server side logic for that..also send page number and count in your `http` request.. – Rayon Dec 14 '15 at 07:50

0 Answers0