Announcement

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

  • Problem with ListGrid getCellCSSText in grouped ListGrid

    Hi Isomorphic,

    I'm trying to create a JS testcase for a problem I have in SmartGWT. Now I'm stuck at a place where I'm not sure if the code is correct or if this is an issue.
    Please see this sample (v11.1p_2018-06-11).

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true, canDragSelect: true,
        sortField: 1,
        data: countryData,
        fields:[
            {name:"continent", title:"Continent"},
            {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},
            {name:"countryName", title:"Country"},
            {name:"capital", title:"Capital"},
            {name:"population", title:"Population", type:"number"}
        ],
    
        getCellCSSText: function (record, rowNum, colNum) {
                if (this.isGroupNode(record)) {
                    return this.Super.getCellCSSText(record, rowNum, colNum);
                }
                else if (this.getFieldName(colNum) == "population") {
                if (record.population > 1000000000) {
                    return "font-weight:bold; color:#d64949;";
                } else if (record.population < 50000000) {
                    return "font-weight:bold; color:#287fd6;";
                }
            }
        }
    })
    Once you group by Continent, the design is broken. This seems to be somehow related to the this.Super() call.
    Similar code is working in SmartGWT (I want to show another issue I'm having there, but I'm stuck here for now).

    Is my JS code correct?

    Thank you & Best regards
    Blama

  • #2
    No. See SmartClient Reference for Super() - you pass the method name as the first argument. Looks like your code would simply crash for group nodes.

    Comment


    • #3
      Hi Isomorphic,

      thanks, now it is working.

      Best regards
      Blama

      Comment

      Working...
      X