Login Register

Grid sort fails on columns containing empty cells

It seems that sorting on a column in a Grid does not work as I would expect when some of the cells in the column are empty. I have a Grid in which some of the fields are only populated for some rows. Sorting on columns with data in every row works fine, but when I sort on the columns with patchy data, the rows do get re-ordered, but in an apparently semi-random fashion, with the blank values scattered through the column, and even the rows with real values not ordered in any obvious way.

i) is this a known problem? (I searched but couldn't find anything.)
ii) is there anything I can do about it? I will probably try changing the empty strings to non-breaking space characters if there is not a more elegant way (which would, I see from other posts, at least also solve the other problem of the missing right border on those cells).

I am using Dojo 1.0.2 on IE6, and the model is created as a dojox.grid.data.Objects from Ajax JSON data.

Simon

A quick test seems to show

A quick test seems to show that, if the cell's value is null, the sort is random as you indicated. If the cell's value is '' (empty string), it sorts OK. This test was by using grid.model.setDatum on a test Grid file. It may be that setting the model or the model to the Grid would convert an empty string to a null, not sure.

You may want to create a new Ticket on this, since null (and maybe empty string) data is very common. To do so, go to http://trac.dojotoolkit.org/timeline, login using user/pw: guest/guest, and the New Ticket option will be available. Please attach a small, but complete example html file to the ticket *after* submitting the ticket. Within the ticket itself, describe the steps to duplicate the problem.

Ticket #6084 created, and a

Ticket #6084 created, and a simple example file added. Confirmed that empty strings sort OK - my JSON data has nulls, coming originally from an Oracle database. I'll have to look at my server-side coding and see how easily I can convert the nulls to empty strings there. Trouble is Oracle treats empty strings as nulls.

Thanks. Yep, I've just

Thanks. Yep, I've just gotten in the habit of, on the server side, after a db select, checking for null/empty strings and replacing with  , to avoid the other problem you mentioned above, cell formatting of null/empty cells.

has this ticket been resolved?

was Ticket #6084 resolved? i did not see any updates on the ticket.

if there is a patch, pls update.