Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

null value in summary data formatted as 0?

$
0
0
Hi, we are seeing a problem where a null value in a summary function is being treated like 0.


See the price column in this example and use the sample code below. We want the summary data for Price to show as blank and this was working in 8.3 so something changed with 9.0.

http://www.smartclient.com/#summaryGrid

Code:




isc.ListGrid.create({
    ID: "companyList",
    width:600, height:520,
    alternateRecordStyles:true,
    autoFetchData:true,
    dataSource:orderItemLocalDS,
    showAllRecords:true,
    groupByField:"category", groupStartOpen:"all",
    canEdit:true, editEvent:"click",
   
    showGridSummary:true,
    showGroupSummary:true,
    fields:[
        {name:"orderID", includeInRecordSummary:false, summaryFunction:"count"},
        {name:"itemDescription"},
        {name:"category", showGridSummary:true,
            getGridSummary:function (records, summaryField) {
                var seenCategories = {};
                for (var i = 0; i < records.length; i++) {
                    seenCategories[records[i].category] = true;
                }
                var totalCategories = isc.getKeys(seenCategories).length;
                return totalCategories + " Categories";
               
            }
        },
        {name:"shipDate", showGroupSummary:true, showGridSummary:false, summaryFunction:"max"},
       
        {name:"quantity", showGroupSummary:false, showGridSummary:false},
        {name:"unitPrice", showGroupSummary:true, showGridSummary:true,summaryFunction:'return null;',
        formatCellValue:function (value) {

           
            if (value!=null && isc.isA.Number(value)) {
                return value.toCurrencyString("$");
            }
            return value;
        }
        },
        {name:"Total", type:"summary", recordSummaryFunction:"multiplier",
        summaryFunction:"sum",
        showGridSummary:true, showGroupSummary:true,
        align:"right",
        formatCellValue:function (value) {
            if (isc.isA.Number(value)) {
                return value.toCurrencyString("$");
            }
            return value;
        }
        }
    ]
})


Viewing all articles
Browse latest Browse all 4756

Trending Articles