1

My problem is that I could not find ANY simple example how to fetch data from list using SPServices.

For example I have a list under

http://mysharepoint/sites/mysite/Lists/Experts/AllItems.aspx

there is really BIG list, but I want for testing purposes only fetch for example columns called Name and Title.

What are my special requirements? I want to fetch that data and push them to my jqGrid which is on site:

http://mysharepoint/sites/mysite/Lists/Experts/FilterTest.aspx

So I assume I have to run SPServices script on FilterTest.aspx and fetch data from AllItems.aspx but I did not see any really simple and well explained tutorial.

Can I please ask for your help?

I will parse JSON from SPServices to be valid for jqGrid but first of all I don't know how to even get this JSON.

susanoo
  • 289
  • 4
  • 13

1 Answers1

0

You can try first of all to get the data using Ajax requests described here. You need just set headers: {"Accept": "application/json; odata=verbose"} as additional parameter of jQuery.ajax. You can do the same in jqGrid by usage

ajaxGridOptions: { headers: {"Accept": "application/json; odata=verbose"} }

The options from ajaxGridOptions will be forwarded to underlying Ajax request.

You can find more details here. Another way will be to generate SOAP requests as text and to send there. The SOAP response is XML data and there can be read by jqGrid too. See the answer. It will work too, but the usage of Odata request with JSON data is better. One have readable URL where you can place the filter, sorting criteria and so on. The returned data are JSON data, which one can read by jqGrid.

I found the video on yourtube with information from SharePoint Conference 2014. It provides detailed information how to get data from SharePoint server in JSON format. If you will have implementation problems (reading of the JSON returned from SharePoint), you can ask new question and include an example of JSON response. You can use Fiddler or Developer Tools of IE/Chrome to get exact HTTP traffic.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798