0

example: I have 10 items in a list. I want to display only 8, 9, and 10.

if I use '&$top=10&$orderby=Created desc', it is giving me 10, 9 , and 8. if I use '&$top=10&$orderby=Created asc'..., it is giving me 1, 2, and 3.

any way around this?

2

Ideally you can use multiple columns in orderby field. So in your case you can do something like

$top=10&$orderby=Created desc, Id asc

I tried above and for some reason it is not working. What you can do is once you receive the result read it from the end and come forward as below

success: function (data) {
    if (data.d.results.length > 0 ) {
        for(i = data.d.results.length - 1; i >= 0; i--) {
            alert(data.d.results[i]);
        }
    }       
}
0

?$top=10&$orderby=Created desc,Id
works like a charm

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.