Announcement

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

    Patch for getSummaryValue for 9.0

    Hi, just evaluating Smartclient 9.0 and found the need for this patch that does a null check on records at the top

    Code:
    	if (window.isc &&  isc.version.startsWith("v9.0")){
    		
    		isc.ListGrid.getPrototype().addProperties({
    			// getSummaryValue() - generic handler to take a bunch of records and a field definition and
    			// return the summary value from them. Used for both grid level summaries and group-level summaries
    			getSummaryValue : function (records, field) {
    
    				//7/31/13.. needed null check here
    				if(records==null){
    					return null;
    				}
    			    // pull out any records where includeInSummary is false
    			    var includedRecords = [];
    			    for (var i = 0; i < records.length; i++) {
    			        var record = records[i];
    			        if (!record || (record[this.includeInSummaryProperty] == false)) continue;
    			        includedRecords[includedRecords.length] = record;
    			    }
    
    			    var summaryFunction = this.getGridSummaryFunction(field);
    			    if (summaryFunction != null) {
    			        if (!isc.isAn.Array(summaryFunction)) {
    			            summaryFunction = [summaryFunction]
    			        }
    			        var results = [];
    			        for (var i = 0; i < summaryFunction.length; i++) {
    
    			            var currentFunction = summaryFunction[i];
    			            if (currentFunction != null) {
    			                var r = isc.SimpleType.applySummaryFunction(includedRecords,
    			                                            // Pass the component into 'applySummaryFunction' as
    			                                            // an extra, undocumented param.
    			                                            // We use this to handle resolving "absolute" dataPaths
    			                                            // on fields
    			                                            field, currentFunction, this);
    			                if (!r) r = 0;
    			                results[i] = r;
    			            }
    			        }
    			        return results;
    			    }
    			    return null;
    			}
    		})
    
    	
    	}

    #2
    Thanks for the suggestion. We've incorporated this into the framework. Should be present in 9.0p and 9.1d builds dated Aug 2 and above.

    Regards
    Isomorphic Software

    Comment

    Working...
    X