Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Grid sorting with multiple columns

    Hello,

    there is a problem with sorting of a grid with multiple columns.

    Field 1 is a field of type "date".
    Field 2 is a numeric field with a sort normalizer.
    => The sorting can be incorrect.

    The error is in ISC_Core.js (Version v10.0p_2015-04-28/Pro) in funtion sortByProperties from line 25763 to 25882:

    Code:
            if (isc.isA.Function(normalizer)) {
    ...
                    if (dataType != null && !Array._matchesType(item[this.sortProps[i]], dataType)) {
                        wrongTypeArray[i][ii] = item[this.sortProps[i]];
                    }
    ...
            } else {
                // if not passed an explicit normalizer, choose the appropriate function to normalize data
                // (see above)
                var dataType = null;
    ...
    dataType is set here in multiple lines
    25806, 25825, 25833
    ...
                    if (dataType != null && !Array._matchesType(atomicValue, baseType)) {
                        wrongTypeArray[i][ii] = item[this.sortProps[i]];
            }
    When sorting, the first field runs into the else part and dataType is set to "date".
    The second field runs into the normalizer part, but there is no setting of the dataType variable, so the value of it is "date". Because the type of the field isn't date, the wrongTypeArray value is set and later the field will be sort by the wrongTypeArray value and not by the normalized value.

    Please fix it.

    Regards

    Peter

    #2
    We were unable to reproduce your issue. According to the following test code, everything works as expected.
    Code:
    countryData1 = [
    {
        countryName:"United States",
        countryCode:"US",
        area:9631420,
        independence:new Date(1776,6,4)
    },
    {
        countryName:"China",
        countryCode:"CH",
        area:10003,
        independence:new Date(1947,7,15)
    },
    {
        countryName:"Japan",
        countryCode:"JA",
        area:10002,
        independence:new Date(1947,7,15)
    },
    {
        countryName:"India",
        countryCode:"IN",
        area:10001,
        independence:new Date(1947,7,15)
    },
    {
        countryName:"Germany",
        countryCode:"GM",
        area:357021,
        independence:new Date(1871,0,18)
    }
    ]
    
    
    isc.DataSource.create({
        ID: "countryDS",
        fields:[
            {name:"countryCode", title:"Code"},
            {name:"countryName", title:"Country"},
            {name:"area", title:"Area", type:"integer"},
            {name:"independence", type:"date"}
        ],
        clientOnly: true,
        testData: countryData1
    })
    
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true, showAllRecords:true,
        dataSource: countryDS,
        autoFetchData: true,
        canMultiSort: true
    })
    Can you reproduce your issue with this code?. if so, please provide details to reproduce it, otherwise, post your test code so that we can test it.

    Thanks,
    Isomorphic Software
    Last edited by Isomorphic; 30 Apr 2015, 06:35.

    Comment


      #3
      Hello,

      here is the test code to reproduce the problem.

      When sorting by "name", the result is correctly "a, c, b", because there is a SortNormalizer set for the field.

      When setting the sort configuration as you see in the SortConfiguration.jpg-Snapshot, the result is "a, b, c". That is worng.

      Please note my hint in the first post.

      Regards

      Peter
      Attached Files

      Comment


        #4
        Hello,

        do I have the chance, that you fix that bug?

        Peter

        Comment


          #5
          It's being looked into - we'll update here when it's been addressed.

          Comment


            #6
            This is fixed for builds dated June 3 and later.

            Comment


              #7
              Thank you, it's fixed now.

              Comment

              Working...
              X