Announcement

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

    listgrid sorting alphanumeric

    When I sort by string field, it does not seem to be case sensitive. Is this the way sorting is supposed to behave? I expect the words that start with a lowercase letter to appear first in the list

    Code:
    
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true,
        data: countryData,
        fields:[
            {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},
            {name:"countryName", title:"Country"},
            {name:"population", title:"Population", formatCellValue:"isc.Format.toUSString(value)"},
            {name:"area", title:"Area (kmē)", formatCellValue:"isc.Format.toUSString(value)"}
        ],
        // initial sort on Population, high-to-low
        sortFieldNum: 1,
        sortDirection: "ascending"
    })
    data:

    Code:
    countryData = [
    
    {
        continent:"North America",
        countryName:"United States",
        countryCode:"US",
        area:9631420,
        population:298444215,
        gdp:12360.0,
        independence:new Date(1776,6,4),
        government:"federal republic",
        government_desc:2,
        capital:"Washington, DC",
        member_g8:true,
        article:"http://en.wikipedia.org/wiki/United_states"
    },
    {
        continent:"Asia",
        countryName:"china",
        countryCode:"CH",
        area:9596960,
        population:1313973713,
        gdp:8859.0,
        government:"Communist state",
        government_desc:0,
        capital:"Beijing",
        member_g8:false,
        article:"http://en.wikipedia.org/wiki/China"
    },
    {
        continent:"North America",
        countryName:"Canada",
        countryCode:"CA",
        area:9984670,
        population:33098932,
        gdp:1114.0,
        independence:new Date(1867,6,1),
        government:"constitutional monarchy with parliamentary democracy and federation",
        government_desc:1,
        capital:"Ottawa",
        member_g8:true,
        article:"http://en.wikipedia.org/wiki/Canada"
    },
    {
        continent:"Asia",
        countryName:"Indonesia",
        countryCode:"ID",
        area:1919440,
        population:245452739,
        gdp:865.6,
        independence:new Date(1945,7,17),
        government:"republic",
        government_desc:5,
        capital:"Jakarta",
        member_g8:false,
        article:"http://en.wikipedia.org/wiki/Indonesia"
    }
    
    ]

    #2
    oops. please remove this thread. it works as expected. canada precedes Canada

    Comment


      #3
      That's the browser's concept of locale-sensitive sort for whatever locale you're in. It can differ by browser if they have a different concept of what the right sorting behavior is for the locale.

      If you want something different, use the sortNormalizer API.

      Comment


        #4
        Hi,
        This problem exists for me where it sorts case insensitive when the text is ALL caps.
        For example:

        My column data is:

        test
        test
        TEST
        test
        Test

        When sort by ascending it shows as the above as the outcome. If the upper case is just one letter then it sorts accordingly but it the whole word is all caps then it ignores the cases.

        1. SmartGWT 2.4, Browser IE 8.
        2. I use a data source and i set this column as text, I also have a listgridField for this because it need to control the column size.

        Please advise. Your input is appreciated.

        Regards,
        vnta

        Comment

        Working...
        X