开发者

ADO.NET data services Combining Orderby and expand on REST

开发者 https://www.devze.com 2023-01-12 09:11 出处:网络
I am trying to get the list from server through javascript using following var request = new Sys.Net.WebRequest();

I am trying to get the list from server through javascript using following

var request = new Sys.Net.WebRequest();
request.set_httpVerb开发者_Python百科("GET");
//request.set_orderby("Created");
request.set_url("http://sps2010:39153/_vti_bin/ListData.svc/MyList?$expand=CreatedBy");
request.get_headers()['Accept'] = 'application/json';
request.add_completed(handleRequestComplete);
request.invoke();

Now I want to order above with one of the column, I can order it without using expand, i.e

request.set_url("http://sps2010:39153/_vti_bin/ListData.svc/MyList?$orderby=Created desc");

But I can't combine expand and orderby ... strange ... any ideas?


I found the answer to my own question.... here is how you combine expand and orderby

http://sps2010:39153/_vti_bin/ListData.svc/MyList?$expand=CreatedBy&$orderby=Created

easy really once you know how ... :) hope it will save you guys some time ...

0

精彩评论

暂无评论...
验证码 换一张
取 消