I am trying to add the sorting on SharePoint list using Rest services but it is not working.

I am adding sorting on the basis of particular columns(Description, Col_Order), columns have values 1,2.

If the Col_Order have entered the numeric values then it should sorted in ascending order. If not then sorting should be on the basis of Description columns. But the sorting is not get work.

I am adding like in below:

  • Is WasteCodes is display name of your list? – Ganesh Sanap Aug 2 '19 at 6:30
  • @GaneshSanap Yes. In this list have the Description and Col_Order columns. – Mobile Test Aug 2 '19 at 6:35

Try using below REST Query:

http://dev.listdata.com/_vti_bin/listdata.svc/WasteCodes?$select=Col_Order,Description&$orderby=Col_Order asc,Description

Or try using something like below REST API:

siteUrl/_api/web/Lists/getbytitle('ListName')/items?$orderby=Col_Order asc,Description


Using the REST Interface.

| improve this answer | |
  • It's not showing results correctly. – Mobile Test Aug 2 '19 at 6:37
  • This query will order your list items in ascending order by Col_Order and then by Description – Ganesh Sanap Aug 2 '19 at 6:38
  • You got the logic but it sort the list by Description – Mobile Test Aug 2 '19 at 6:46
  • In Second URL, if the Col_Order is null then the result will always come at top order. – Ganesh Sanap Aug 2 '19 at 6:51
  • Second URL showing the same way list is showing sorting by Description. – Mobile Test Aug 2 '19 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.