开发者

OData Services and Silverlight Client Side Paging, am I missing something?

I've got a silverlight application where I'm using the MVVM approach and retriving data from an oData service. What I'm wanting to do is use the built in data grid and data pager controls to display and move through the returned data. After a couple hours of research, I feel like there is no good built in way to do this. I think it is going to require me writing some custom paging and buildin开发者_运维知识库g my paged queries by myself. Everything I can find about the PagedCollectionView seems to indicate it only works on data that is already cached on the client side. Since I don't want to pull thousands of records from the oData service at once, that won't work. Is there something I'm missing here? Something inherant about the DataServiceCollection or something that allows me to let the data pager handle building the queries automatically?


Here's a custom implementation, it modifies the OData query to support paging http://blogs.msdn.com/b/phaniraj/archive/2010/08/19/implementing-server-side-sorting-paging-for-odata-feeds-in-silverlight-controls-datagrid-datapager-dataform.aspx

The article wasn't too great, but after some fiddling (removing the Frame and just adding DataGridSupport as a UserControl, and making the NewItemPlaceholderPosition property auto-implemented) I did got his source code to work. It's pretty impressive http://cid-925c2d2bb2d03c6b.office.live.com/self.aspx/Public/EuphoriaClientApp.zip


Is that an external OData service, or on your own server?

If on your own service, use RIA services instead. Then paging is trivial.

If on another server, implement RIA services anyway, but get your server to fetch the Odata, in a paged fashion, and return via RIA services linq queries.

If you can provide more specific details of the data service and your server setup I will try provide specific details.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜