Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#4491 closed defect (fixed)

Datastore items sort incorrectly on attributes with null values

Reported by: Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.0
Component: Data Version: 0.9
Keywords: datastore sort null undefined Cc:
Blocked By: Blocking:


Datastore items sort incorrectly on a attribute/column for which some items have the attribute set to null.

The datastore ReadAPI doc for the "sort" parameter states:

when comparing attributes, if an item contains no value for the attribute (undefined), then it the default ascending sort logic should push it to the bottom of the list. In the descending order case, it such items should appear at the top of the list.

One would expect this same behaviour for attributes that are set to the javascript null (that is generally more or less used in equivalent way to javascript undefined).

To reproduce [working with revision 10544] take the test file at: dojox/data/demos/demo_DataDemoTable.html and modify the countries.json file that is loaded into the first datastore, by adding a:


attribute to a bunch of country items that do not have it. Then reload, and try sorting on the population column.

Change History (6)

comment:1 Changed 14 years ago by dante

Component: GeneralData
Owner: changed from anonymous to Jared Jurkiewicz

comment:2 Changed 14 years ago by

Cc: [email protected] removed

comment:3 Changed 14 years ago by

Reporter: changed from guest to

comment:4 Changed 14 years ago by Jared Jurkiewicz

Actually, null is an object. It's not 'undefined'. Has an actual different meaning. Fixing should be easy, though, to make it act similar.

comment:5 Changed 14 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [10710]) Minor fix to sorter. fixes #4491

comment:6 Changed 14 years ago by Jared Jurkiewicz

Tested on Firefox, Safari B3, and IE 6

Note: See TracTickets for help on using tickets.