Results 1 to 3 of 3

Thread: [OPEN-1327] TreeSorter cannot sort numerical attributes

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Jan 2009
    Location
    Lille
    Posts
    24
    Vote Rating
    0
      0  

    Default [OPEN-1327] TreeSorter cannot sort numerical attributes

    Ext version tested:

    • Ext 3.3



    Adapter used:

    • ext




    Description:

    • When you want to sort your nodes using an numerical attributes in your node(immagine a sortIndex computed), you may want to follow the doc so you put the property token to 'sortIndex' and you do not provide sortType fn.

      In the treeSorter code,
      Code:
      (Ext.isString(sortType))
      is false so sortType fn is still undefined so if caseSensitive is not defined, it tries to uppercase a integer .... boom

    The documentation should also mention that it is possible to use the Ext.data.SortTypes as text in sortTypes

    Code:
         if(Ext.isString(sortType)){ 
    sortType =  Ext.data.SortTypes[sortType]; 
     } 
    this.sortFn =  function(n1, n2){ 
     var attr1 = n1.attributes, 
     attr2 =  n2.attributes; 
    
                 
     if(folderSort){ 
     if(attr1[leafAttr] && !attr2[leafAttr]){ 
     return 1; 
     } 
     if(!attr1[leafAttr] && attr2[leafAttr]){ 
     return -1; 
     } 
     } 
     var prop1 =  attr1[prop], 
     prop2 =  attr2[prop], 
     v1 = sortType ?  sortType(prop1) : (caseSensitive ? prop1 : prop1.toUpperCase()); 
     v2 = sortType ?  sortType(prop2) : (caseSensitive ? prop2 : prop2.toUpperCase());

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    I don't see a problem, apart from the fact that you have to specify caseSensitive:true to be able to sort numerical values (which could be added to the docs).

  3. #3
    Ext User
    Join Date
    Jan 2009
    Location
    Lille
    Posts
    24
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by Condor View Post
    you have to specify caseSensitive:true to be able to sort numerical values.
    Quote Originally Posted by Condor View Post
    I don't see a problem
    So neither do I ;-)

Similar Threads

  1. Replies: 13
    Last Post: 23 Jun 2011, 11:30 AM
  2. Replies: 1
    Last Post: 20 Jul 2010, 9:04 AM
  3. Treegrid sort error - n1.attributes[p] is undefined
    By trtechservices in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 5 May 2010, 10:17 AM
  4. Sorting numerical data
    By Chamster in forum Ext 2.x: Help & Discussion
    Replies: 22
    Last Post: 13 Jan 2009, 6:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •