I have a grid using an ItemFileReadStore (actually same thing happens with a QueryReadStore and doClientPaging=true) with a moderately large (600 record x 9 field) dataset.
Performance stinks with Firefox, and is decent with Microsoft Internet Explorer, but that's not the issue.
When I click on a column header to reverse sort, the grid seems to be quite "confused". Scrolling causes even more confusion.
(See next response - I've editing this after adding sequential numbers to the dataset to get a better picture of what's happening.)

Argh! It's worse than I thought!
OK, it was easy enough to add a column with sequential numbers.... Here's what I get.
My dataset has
1.
.
.
667
The grid initially shows
1
.
.
.
20
The first time I click on the serial# column header, nothing happens - I guess that is normal. The down arrow (shouldn't it be an up arrow? Easy to fix) appears, I guess to indicate that that's the sort column.
I click on it again, and I see
30
.
.
.
10!
Scroll down, and now I see:
9
.
.
.
1
31
.
.
.
39!
TOTALLY confused!
Scroll all the way to the bottom, I get:
647
.
.
.
667
With an UP arrow!
Scroll to the top:
30
.
.
.
10!
Click on the column header:
1
.
.
.
20
Click it again:
667
.
.
.
647
Holy moley, scroll a bit and I get:
646
.
.
.
631
450
449
What am I doing wrong? This can't be right!
Model doesn't sent sort to the store?
I've been doing some searches, and I think I know the problem. It appears that the model doesn't ask the store to sort at all! There's a patch for this that isn't in 1.0.2. It simply sorts the data that the model has (keepRows?)
So, just how do I ask the store to sort?
I'm assuming that I have to get click events on the column headers, ask the store to sort (how?) then ask the grid to update?
I'm a bit shocked that the documentation mentions nothing of this!
It all has you happily clicking on headers and seeing the data sort magically. Yea, as long as you just have a small demo dataset that fits conveniently into the small number of rows that the model keeps (looks like 100 by default?)
I guess I have to look at the examples for QueryReadStore to see how to do this. I'd hoped I wouldn't have to go to all that trouble, given that I'm loading all the data into the client anyway.
Possible workaround
You might want to try cutting out the store altogether, and using a Grid with a dojox.grid.data.Objects model. I am using that method, for other reasons, but I have no problems with sorting, even with large datasets (500+ rows, ~25 columns in the data, not necessarily all of them shown in the grid. It does require a slightly different format to the JSON data, and you have to do the xhrGet/xhrPost yourself, but it is fairly straightforward. The JSON data should be structured as an array of objects conatining named fields corresponding to your columns, and depending on your requirements you could add the data request and grid population to the dojo.addOnLoad or to a button onClick handler, etc. As a simple example, if you have declared your Grid with jsId="myGrid" and set up your view and layout like this:
var myView = { cells: [[ { name: "ID", field: "id" }, { name: "Description", field: "desc" } ]] }; var myLayout = [ myView ]; myGrid.setStructure(myLayout);then your JSON data would need to have the format:
[{"id":1,"desc":"Item 1"},{"id":2,"desc":"Item 2"}, ... ]and, assuming a simple GET request would work, your dojo.addOnLoad, button handler or whatever would need to contain code similar to the following:
dojo.xhrGet({ url: "myPage.php?category=widgets", handleAs: "json", load: function(response, ioArgs) { myGrid.setModel = new dojox.grid.data.Objects(response); myGrid.refresh(); return response; }, error: function(errdata, ioArgs) { window.alert("Error: " + errdata.message); return errdata; } });If you want to get a little more sophisticated, you can make the data a sub-object in the JSON response, and use other sub-objects to pass messages, errors etc.
Simon