I just ran across what I consider a significant deficiency in Flex. 
To correct this problem would require an addition of two attributes 
to the mx:DataGridColumn class.

I could make a change to my version of the language, or perhaps I 
could create an inherited class. However, I feel strongly that the 
problem is so fundamental that it should be changed in the language. 
How do I go about making this happen?

The problem is this;

It appears that when sorting a DataGrid by clicking a column that 
Flex currently does its best to determine the data type and sorts 
based on that data type. The problem is that it gets confused when 
there are nulls in date, numeric, or boolean fields. When it gets 
confused it ralph's on its shoes (blows up). Based on my research, 
including reading a bit of the file sortField.as, this is by design.

There is a way around it but it requires instantiating a compare 
function for each column that might get a null, and might be one of 
non string data types. The workaround is to create a function, and 
use the "sortCompareFunction" attribute to call a that function. 
There is even a kludgier workaround to make the function generic by 
using the "headerRelease" attribute of the DataGrid to update a 
public variable with the column number.

Since it seems as though this is an ubiquitous problem, it should be 
solved in the language itself. The best approach that I came up with 
is to have two new attributes for the mx:DataGridColumn;

sortDataType - Basically specify the type of data contained in the 
column that would be honored by the sort routine irrespective of the 
values contained in the column. Values would be any valid data type.

sortNullCollatingSequence - This would define whether nulls get 
sorted to the top or bottom of the list. Values would be low - which 
would indicate that nulls would sort lower than the lowest normal 
value, and high - which would indicate that nulls would sort higher 
than the highest normal value.

This is one possible solution, there may be better ones but in my 
opinion the current method should be improved. I would like to see it 
implemented quickly as I believe it is a serious problem.

How do I go about getting this taken seriously, and not assigned 
an "enhancement request number" and never looked at again?

Paul

Reply via email to