:: Forum >> Version 2 >>

sort problem with equal values

The 2nd column in the following grid does not sort correctly in IE, I think because of a bug in AW.Grid.Controllers.Sort.

<script>
var 
obj = new AW.UI.Grid;
var 
rowdata = [
    [
32],
    [
21],
    [
12]
];
obj.setRowCount(3);
obj.setColumnCount(2);
obj.setCellText(function(col,row){return "value[" row "," 
                 
col "]=" rowdata[row][col];});
obj.setCellValue(function(col,row){return rowdata[row][col];});
document.write(obj);
</
script
The sort problem can be fixed by calling obj.setCellFormat(number, 1). But I think the real fix is to AW.Grid.Controllers.Sort, below:

else if ("".localeCompare) {
        return function(
ij){
            
try {
                var 
values[i], values[j], xy;
                if (
typeof(a) != typeof(b)){
                    
types[typeof(a)];
                    
types[typeof(b)];
                    if (
y) {return greater}
                    if (
y) {return less}
                } else if (
typeof(a)=="number"){
                    if (
b) {return greater}
                    if (
b) {return less}
    
// Next line is new !!
                    
return equal(i,j);
                } else ...
 
CK
Tuesday, April 11, 2006
Yes, that's a bug - thanks a lot for finding this!
Alex (ActiveWidgets)
Tuesday, April 11, 2006
Alex - I just upgraded to 2.0.1 and noticed that this fix was not included.
CK
Friday, August 11, 2006
Yes, somehow I got confused by this one - will be in 2.0.2

Alex (ActiveWidgets)
Friday, August 11, 2006
Hi Alex

Is the sorting algo aw is using is mergesort ?I have also seen that is occurs because mergesort is Unstable sort and quicksort is stable kind of sort.

Thanks
Vikramaditya Garg
Vikramaditya Garg
Sunday, August 13, 2006



This topic is archived.

Back to support forum

Forum search