:: Forum >>

Strange sorting... (bug?)

I have 6 columns and 3 of them are dates with format... And some of that dates don't are required so i have defined the error text of date format as "_Undefined"... And the problem comes when i try to order that column, because don't group all the undefineds and left in the middle some dates that must are on top or bottom. All other columns sort perfect...

Code sample:
var myData = [
['Row 1','5/10/2004','','','0','1']
,['Row 2','5/10/2004','','','0','4']
,['Row 3','5/10/2004','','','0','5']
,['Row 4','5/10/2004','','','0','6']
,['Row 5','5/11/2004','','','0','11']
,['Row 6','5/11/2004','','','0','13']
,['Row 7','5/11/2004','','','0','14']
,['Row 8','5/13/2004','','','0','18']
,['Row 9','5/13/2004','','','0','19']
,['Row 10','5/13/2004','','','0','20']
,['Row 11','5/13/2004','','','0','22']
,['Row 12','5/13/2004','','','0','23']
,['Row 13','5/13/2004','','','0','24']
,['Row 14','5/18/2004','','','0','25']
,['Row 15','5/18/2004','','','0','27']
,['Row 16','5/18/2004','','','0','32']
,['Row 17','5/18/2004','','','0','35']
,['Row 18','5/18/2004','','','0','36']
,['Row 19','5/19/2004','1/30/2006','4/1/2005','0','38']
,['Row 20','5/19/2004','7/1/2004','6/30/2004','2','41']
,['Row 21','5/20/2004','','','0','42']
,['Row 22','5/20/2004','','','90','44']
,['Row 23','5/24/2004','','','0','46']
,['Row 24','5/24/2004','','','0','47']
];
        
var myColumns=["Name","Created (date)","End (date)","Start (date)","Hours","ID"];

var obj = new Active.Controls.Grid;

var string = new Active.Formats.String;
string.dataToValue = function(data){return data.toUpperCase();};
var date = new Active.Formats.Date;
var number = new Active.Formats.Number;

obj.setRowCount(myData.length);
obj.setColumnCount(myColumns.length);

number.setTextFormat("#");
                    
date.setDataFormat("auto");
date.setTextFormat("dd/mm/yyyy");
date.setErrorText("_Undefined");
date.setErrorValue("-1");

var formats=[string,date,date,date,number,number];

obj.setColumnText(function(i){return myColumns[i]});
obj.setDataText(function(i, j){return formats[j].dataToText(myData[i][j])});
obj.setDataValue(function(i, j){return formats[j].dataToValue(myData[i][j])});
JPM
Tuesday, May 25, 2004
I have performed some test in that case and i have arrived to a conclusion: date.setErrorValue(value) apears to not work... Cause don't get the value and set all to NaN;

I have tryed to pass a string, and a value to fuction...

Any Idea?
JPM
Friday, May 28, 2004
You are right, the setErrorValue call was ignored. I just posted corrected code here:

http://www.activewidgets.com/messages/1252-0.htm

Now you can push your non-dates all up or down by setting error value to 0 or Infinity.
Alex (ActiveWidgets)
Friday, May 28, 2004

This topic is archived.


Back to support forum

Forum search