开发者

Client-side sorting by client-side property in ria services

I have a WCF RIA Services project using MVVM pattern and DomainCollectionView object. I should be able to add two properties to a class that origins from the EF DataModel.The properties are added at the client-side only and displayed on the datagrid. So far so good. When I'm trying to sort the data by clicking on one of the two additonal columns' headers nothing happens. Is it because the server knows nothing about those properties? If so what is the most appropriate way of dealing with such a reques开发者_如何学JAVAt?


You are correct that DomainCollectionView generates a query client side, that is then executed server side. Hence the preparation of the results (and perhaps included entities) are prepared by the server side DB service in the order you request. The entities are then serialized and returned to the client.

Once your Grid visualizes however, it creates an ICollectionView from the source that you provide. This interface allows for client side filtering and sorting.

When somebody clicks on a column in the grid, the grid (either auto magically, or by code, or both - depending on the vendor of the grid control) will use this interface to sort/filter the data.

DomainCollectionview also allows for Paging, which limits the amout of data retrieved into the grid. and facilitates "chunks" of data to be brought down to the client. Nobody wants to transport, then filter 1000 records (let alone 100) records within the grid (). If there is a lot of data, use the grid for navigation, and then a detail form to show the details (getting the details after the selection).

HTH, Richard

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜