Tuesday, June 14, 2016

Get REST data from SharePoint List more than 50 items

   $.ajax({
                  type: 'GET',
                  url: url +"_api/web/lists/getbytitle('ReportingList')/Items?$skiptoken=Paged=TRUE&$top=1000&$select= CountryCodeInMap,CountryColourInMap",
                  headers: { "Accept": "application/json;odata=verbose" },
                  cache: false,
                  success: function (data) {
                      var colordata = '{';
                      for (i = 0; i < data.d.results.length; i++) {
                          if (data.d.results[i].CountryCodeInMap != null) {
                              colordata = colordata + '"' + data.d.results[i].CountryCodeInMap + '":' + '"' + data.d.results[i].CountryColourInMap + '"';
                              colordata = colordata + ",";
                          }
                      }
                      var data = colordata.substring(0, colordata.length - 1) + '}';
                      renderMap();
                      var jsondata = $.parseJSON(data);
                      jQuery('#vmap').vectorMap('set', 'colors', jsondata);
                  },
                  error: function (status) {
                      renderMap();
                      DisplayErrorMessage("Error loading world map.");
                  }
              });
          });

HTML

Script:

JS