Announcement

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

    apply formatting of formatCellValue to detailField

    Hi, see this example:
    http://www.smartclient.com/#expansionDetailField

    Using this:
    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:300, 
        alternateRecordStyles:true,
        data: countryData,
        fields: [
            {name: "countryName", title: "Country"},
            {name: "capital", title: "Capital"},
            {name: "continent", title: "Continent"},
           {name:"background", formatCellValue:function(value,record){return value.substring(0,5) + "...";}}
        ],
        canExpandRecords: true,
        expansionMode: "detailField",
        detailField: "background"
    });
    Is it possible to apply the formatting of the cell to the detail field as well? If you see, the background cell value is truncated to 5 characters but the expanded detail still shows the entire field.

    #2
    The formatting isn't picked up automatically but this is easy to customize.
    The expansionDetailField which displays the value is created as an autoChild of the listGrid and can be customized via the <autoChildName>Properties block.
    For example an override to getInnerHTML() will give you the behavior you're after:

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:300, 
        alternateRecordStyles:true,
        data: countryData,
        fields: [
            {name: "countryName", title: "Country"},
            {name: "capital", title: "Capital"},
            {name: "continent", title: "Continent"},
           {name:"background", formatCellValue:function(value,record){return value.substring(0,5) + "...";}}
        ],
        expansionDetailFieldProperties : {
            getInnerHTML : function () {
                return this.contents == null ? "&nbsp;" : this.contents.substring(0,5) + "...";
            }
        },
        canExpandRecords: true,
        expansionMode: "detailField",
        detailField: "background"
    });

    Comment

    Working...
    X