Ticket #2542: dojo.data.util.sorter_20070429.patch

File dojo.data.util.sorter_20070429.patch, 0.8 kB (added by guest, 20 months ago)

Modified basicComparator to handle undefined values

  • F:/inetpub/www/js/anon/dojo/anon/dojo/data/util/sorter.js

     
    66        //              Basic comparision function that compares if an item is greater or less than another item 
    77        //      description:   
    88        //              returns 1 if a > b, -1 if a < b, 0 if equal. 
     9        //              undefined values are treated as larger values so that they're pushed to the end of the list. 
    910 
    1011        var ret = 0; 
    11         if(a > b){ 
     12        if(a > b || typeof a === "undefined"){ 
    1213                ret = 1; 
    13         }else if(a < b){ 
     14        }else if(a < b || typeof b === "undefined"){ 
    1415                ret = -1; 
    1516        } 
    1617        return ret; //int, {-1,0,1}