Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm calling web service List.asmx using Jquery and getting results using this but its not ordering by DisplayOrder. This is the caml query.

        <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>Master-Footer-Links</listName> \
                    <viewFields> \
                        <ViewFields> \
                           <FieldRef Name='Title' /> \
                           <FieldRef Name='DisplayOrder' /> \
                           <FieldRef Name='Url' /> \
                       </ViewFields> \
                    </viewFields> \
                    <Query> \
                        <OrderBy><FieldRef Name='DisplayOrder' Ascending='TRUE' /></OrderBy> \
                    </Query> \
                </GetListItems> \
            </soapenv:Body> \
        </soapenv:Envelope>
share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

You need to wrap your Query node inside a query node so that it looks like this:

<query>
  <Query>
    <OrderBy><FieldRef Name='DisplayOrder' Ascending='TRUE' /></OrderBy>
  </Query>
</query>
share|improve this answer
add comment

It sounds like your DisplayOrder column type is set to contain strings or text instead of numbers. If you open the list and navigate to Settings -> List Settings then scroll down to Columns, what is the type next to DisplayOrder? If it is "single line of text" or some other string type you can switch the type. Click the name of your column and change the type to "Number (1, 10, 100)" and click OK. You will receive a message about possible loss of data (make sure to have a backup of your list first if this is important data) and click OK on the popup. When you query your list now you should receive numerical sorting instead of alphabetical.

I found this info from this url.

Hopefully you will resolve your issue by this.

Thanks,

Ashish Chotalia

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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