title: How pagination works which is fetch from api in Nativescript
body: <p>I am not getting the concepts of how pagination works in load more requested data from json api. Even i am getting the data of first page but for remaining pages not getting. If I am using the two api for paging and fetching data but still not getting. Any one help me clear this concepts please..</p>
  
  <p>main-view-model.js</p>
  
  <pre><code>const httpModule = require("tns-core-modules/http");
  var observableModule = require("tns-core-modules/data/observable");
  function RegisterViewModel() {
    var viewModel = observableModule.fromObject({
      _sourceDataItems: [],
      initDataItems: function () {
        //This url for the pagination
         var url1 = "https://example.org/api.php?action=query&amp;gcmtitle=Category:xyz&amp;pilimit=max&amp;prop=pageimages&amp;pithumbsize=200&amp;generator=categorymembers&amp;format=json&amp;gcmcontinue=";
  
         httpModule.getJSON(url1).then((r) =&gt; {
  
           id = r.continue.gcmcontinue
          gcm.push(id)
           console.log(gcm)
           var pageid = [];
           for (var id in r.query.pages) {
             pageid.push(id);
           }
           for (var i = 0; i &lt; pageid.length; i++) {
  
  
         if (r.query.pages[pageid[i]].thumbnail == null) {
           let abc = {
             ttt: r.query.pages[pageid[i]].title,
             path1: "~/images/xyz.png"
          }
           this._sourceDataItems.push(abc)
         }
         else {
           let aaa = {
            ttt: r.query.pages[pageid[i]].title,
            path1: r.query.pages[pageid[i]].thumbnail.source
          }
           this._sourceDataItems.push(aaa)
        }
  
           }
  
         }, (e) =&gt; {
         });
  
        var gcm = [];
  
        //This url for the fetching the data on scroll
        for (var i = 0; i &lt; gcm.length; i++) {
  
          var url2 = "https://example.org/api.php?action=query&amp;gcmtitle=Category:xyz&amp;pilimit=max&amp;prop=pageimages&amp;pithumbsize=200&amp;generator=categorymembers&amp;format=json&amp;gcmcontinue=" + gcm[i];
  
          httpModule.getJSON(url2).then((r) =&gt; {
              id= r.continue.gcmcontinue)
          gcm.push(id)
            console.log(r.continue.gcmcontinue)
            var pageid = [];
            for (var id in r.query.pages) {
              pageid.push(id);
            }
            for (var i = 0; i &lt; pageid.length; i++) {
  
               //placeholder Image
  
              if (r.query.pages[pageid[i]].thumbnail == null) {
                let abc = {
                  ttt: r.query.pages[pageid[i]].title,
                  path1: "~/images/xyz.png"
                }
                this._sourceDataItems.push(abc)
              }
              else {
                let aaa = {
                  ttt: r.query.pages[pageid[i]].title,
                  path1: r.query.pages[pageid[i]].thumbnail.source
                }
                this._sourceDataItems.push(aaa)
              }
  
            }
  
          }, (e) =&gt; {
          });
        }
  
      },
  
      _DataItems: [],
  
      addMoreItemsFromSource: function (chunkSize) {
        let newItems = this._sourceDataItems.splice(0, chunkSize);
  
        this._DataItems = this._DataItems.concat(newItems);
  
      },
      onLoadMoreItemsRequested: function (args) {
        console.log("---load item called----");
        const that = new WeakRef(this);
        const listView = args.object;
        if (this._sourceDataItems.length &gt; 0) {
          setTimeout(function () {
            that.get().addMoreItemsFromSource(5);
            listView.notifyLoadOnDemandFinished();
          }, 100);
          args.returnValue = true;
        } else {
          args.returnValue = false;
  
        }
      },
    });
    return viewModel;
  }
  exports.RegisterViewModel = RegisterViewModel;
  </code></pre>
  
  <p>Even loading of the data is working fine for page one. While passing the gcm continue id it wont take that please help me to clear this concept</p>