Upcoming XPO/XtraGrid feature: server-side grouping, sorting, filtering, ...

XPO Team Blog
02 February 2007

We have this really fantastic feature coming up in release 7.1 of DXperience, that I want to tell you about. I had a rather hard time coming up with a title for this post and it’s still rather long (the post as well as the title) – I think it’s not too hard to understand what the feature is about, but it’s hard to summarize in so few words that they fit a blog post title easily.

One problem that people have in .NET (and actually in most other general purpose programming environments that I’m aware of) has to do with the perfect way of handling data that is stored on a server, usually in relational databases. The problem is that there is no such perfect way, and all the technologies that try to tackle the issue are usually really good for one part of the problem and really bad for another.


Two of our products can be used to demonstrate the issue: XPO and the XtraGrid. Both have to do, in the widest sense, with the handling of large amounts of data. XPO deals with the questions of storage – where is that data located, how can I get it from its storage location into my application, how do I handle it once it’s there, and so on. The XtraGrid is all about interactive work with data: view it, arrange it, sort, filter and group it. So what’s the problem? It is that the two products don’t work together the way they could. XPO has great capabilities for filtering data, using criteria that are translated into SQL code. The XtraGrid does filtering, too, but at the same time it doesn’t make assumptions about the source of data that it’s working with, and so it implements its own filtering functionality. The diversity with which we are confronted in today’s programming world is the source of the problem here, and the shortcomings are most visible when the amount of data you’re working with is large.

Let me make it clear that this is not a problem that’s particular to our products. If you’re going for standard Microsoft technology, you have the same problem – ADO.NET allows you to construct complex filtering queries, and the DataGridView has a certain degree of interactive functionality, but the two don’t work together any more than our products do. I’m sure I’m missing something, but I’ve only once before seen a product that could facilitate the kind of technical interaction of layers that I’m talking about here (hi Jason!).

Moving along…

Now we’ve set the stage, what is the feature? Rather simple to explain, suddenly: it’s a technology that allows our grid to make use of the server-side functionality that XPO (or any other data layer) exposes. Interactive sorting of data in the grid is automatically translated into an “order by” that is executed on the server. Same for grouping and filtering, and the XtraGrid never retrieves more information than it actually needs.

At the center of our implementation is a new interface, IListServer, that the XtraGrid can use if configured to do so. XPO 7.1 comes with a component called XPServerCollectionSource, which implements this interface. Hooking the whole thing up is easy: drop an XPServerCollectionSource on your form and configure it, very similar to an XPCollection. Bind the XtraGrid and set the GridControl.ServerMode property to true – done. Easy, isn’t it? From now on the XtraGrid will call the methods of IListServer each time one of the critical operations must be performed on the data, and the XPServerCollectionSource uses the XPO infrastructure to have the operation executed server-side.

Of course it is possible to implement IListServer yourself, and we will possibly provide other such implementations in the future. So the feature is not inherently an XPO only thing – we had to start somewhere. Go ahead and have a look once 7.1 becomes available – your own implementation could be the first.

Great, I'm going to use that all the time...

Well, you probably shouldn’t. As nice as it is, it comes with a few drawbacks that I also want to tell you about. Here’s a quick and possibly incomplete list:

  • Grouping, sorting and filtering work on the server. Haha, I hear you say, you just said that was a good thing. Well, yes it is, but at the same time it can be a problem – there are a number of events in the XtraGrid, that allow you to influence how these functions are performed. But not any longer, when server-side functionality is employed for the purpose. In that case the rule for these functions is: your client can’t do what your server can’t do.
  • Out of the box, it works only with XPO. Personally I like that, but granted, there are people out there who don’t use XPO. That’s why we developed the architecture in such a way that it would be possible to provide a solution to these people as well – the solution itself is not available yet.
  • The implementation of the XPServerCollectionSource doesn’t currently support write access. This is in our plans for future development, so it’s not intended final behaviour. Nevertheless an important thing to know for the time being.


A great and very interesting feature, that’s what I think. It has the potential to greatly enhance performance in those cases where large amounts of data need to be handled in an interactive control. It’s AJAX for Windows Forms, is what one of our developers said. It’s a virtual grid mode based on a single interface, if you like that metaphor better. In any case I think it’s very powerful technology and we probably haven’t realized yet what potential this abstraction has. Be sure to try it out and let us know what you think.

I’m going to take a short break next week – please do leave comments, but be aware that I’ll reply only when I get back.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.