(3.0.0 RC) Grid sort doen't seem to work correctly

I have the impression the grid sort doesn't work correctly yet.

If I sort the grid for example with a date column I get only one row displayed (about 70 are available). But if I click on the date column header I get all columns. It looks like a refresh problem or a bug in the sorter. What do you think?

The result is different if I change the sort key to another column but I get never the complete result with the "automatic" sort.

Unfortunately, your example isn't complete enough for anyone to run - the RPC interfaces, servlet code, and models are all missing. Instead of including those, try to make the example simple enough to just generated data on the client.

Without knowing the conditions that make the grid avoid drawing items, it is hard to say what the bug might be. The main things I can think of are that perhaps your key field isn't actually unique, or that there is a bug in sorting items that are exactly the same. Are you able to reproduce this behavior at http://sencha.com/examples-dev/ ?

Second attempt

Thanks for the input. I tried now to get working an example to show the behavior without using remote server calls. During this tries I think I got closer to the problem. It may have to do with a client side call back. We name this "SimpleCallback" to get some values from a popup. This simple callback looks like this

I hope this is enough information. Again, the problem with the sorting and display issue only happens when using the async call. If the data load is outside of the call then the data is properly displayed and sorted.

Just a tip, in your PropertyAccess, you can annotate your ModelKeyProvider line with @Editor.Path("voucherId") since your getKey() method simply returns the same value as getVoucherId(). This allows you to remove the get/setKey method in your bean.

We're doing a ton of grid sorting and filtering in 3.0RC and it's working correctly. Can you please confirm that your server side query is actually finding and attempting to return the ~70 or so results you say should be returned? Are you using remote sort?

Since breakpoint debugging GXT client-side is difficult (at least, I've never gotten it to work, let alone actually load in hosted mode), try setting a breakpoint in your server-side code and seeing if the data you're getting from the client is what you expect. Some gotchas that bit us initially:

The value provided by key() MUST provide a unique value across all your beans in the list store.

The name of the sort field comes from the name in the PropertyAccess interface - as this may not map directly to your database columns and you'll need to "translate," though, you should see SQL errors if this isn't fixed.

We found that our initial page load for our grid (and subsequent data store load) did not provide any sort info, i.e. PagingLoadConfig.getSortInfo().isEmpty() == true, so we had to specify our initial sort field and sort direction for our query.

The datatype in your property access may not map directly to the column type in the database, e.g., we have some numerical fields that get mapped to enums in our bean so we're dealing with concrete types everywhere.

Let us know what your server-side method is getting and if it returns the correct data. This will help narrow the issue to either the client or server side.

Workaround found - but solved?

Thanks for the tips icfantv. I use now the annotation instead of the key-getter. Looks really better since I have unique key fields in the bean.

The server data was and is correctly transferred to the client. Background Info: The data comes only indirectly from a database. I get the data from a application server already filled up correctly. Until here, my problem still exists.

But the point with setting the initial sort info was a good point to think about setting the sort info. I thought, why not setting the sort info every time? So I tried and here is the workaround. So my load part in the AGrid class looks now like the following snippet:

I guess I don't understand why you're loading the vouchers manually. When you construct a grid, you can set a ListLoader on it via setLoader(...). The ListLoader is constructed with a DataProxy which handles the back and forth communication between the client and the server. It's great because all you have to do is supply the load(...) implementation and the API takes care of everything else on the client-side.

In our code, this method implementation is a one-liner, namely the method invocation on our GWT service, i.e.:

Right now, we have about 15 grids and I don't think we've ever had to touch the loadConfig reference as we do all the heavy lifting on the server-side. The API takes care of constructing the LoadConfig and SortInfo objects.