Announcement

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

    null check patch on getGridSummaryData

    Hi,

    We were seeing an intermittent problem in getGridSummaryData. Presumably there was some conflict as we reset field data on a grid at the same time that we were trying to calculate summary data. These super defensive null checks seem to have resolved the issue. Would you consider adding some additional null checks like this into your method?

    Stack of error:
    08:31:12.656:TMR8:WARN:Log:TypeError: Cannot read property '0' of undefined
    Stack from error.stack:
    isc.ListGrid.getPrototype.addProperties.getGridSummaryData() @ js/at_js_static.js?build=V4-0-0_GA,build2903-07-31-2013-3:4522:332
    summaryRow.createAutoChild.$855()
    ListGrid._recalculateSummaries()
    ListGrid.recalculateSummaries()
    eval()
    [c]Class.fireCallback()
    Timer._fireTimeout()
    <anonymous>:1:11() @


    Code:
    	if (window.isc &&  (isc.version.startsWith("v8.3") || isc.version.startsWith("v9.0"))){
    		//added null check 
    		isc.ListGrid.getPrototype().addProperties({
    
    			getGridSummaryData:function(_1){
    				if(this.$84c&&!_1)return this.$84c;
    				var _2=this.completeFields||this.fields,_3=[];
    				
    				//added null check
    				if(_2!=null){
    					for(var i=0;i<_2.length;i++){
    						//added null check
    						if(_2[i]!=null){
    							var _5=_2[i],_6=_2[i].name;
    							if(!this.shouldShowGridSummary(_5)){continue}
    							var _7=this.getGridSummary(_5),_8=this.getGridSummaryFunction(_5);
    							//added null check
    							if(_8!=null && !isc.isAn.Array(_8))_8=[_8];
    							//added null check
    							if(_7!=null &&!isc.isAn.Array(_7)){_7=[_7]}
    					
    							//added null check
    							if(_7!=null){
    								for(var _9=0;_9<_7.length;_9++){
    									//added null check
    									if(_3!=null &&_3[_9]==null){
    										_3[_9]={};
    										_3[_9][this.gridSummaryRecordProperty]=true;
    										_3[_9][this.recordCanSelectProperty]=false;
    										//added null check
    										if(_8!=null && _8[_9]=="count"){
    											var _10=_3[_9][this.recordApplyPluralTitleProperty]||[];_10.add(_6);_3[_9][this.recordApplyPluralTitleProperty]=_10
    										}
    									}
    									//added null check
    									if(_3!=null &&_3[_9]!=null){
    										_3[_9][_6]=_7[_9]					
    									}
    								}
    							}
    							
    						}
    
    					}
    				}
    
    			this.$84c=_3;
    			return _3
    			}
    		
    			
    		})
    	}

    #2
    We will add this null check (should be in the next nightly build).
    However, please note that without seeing a running test case that demonstrates the problem, we don't know for sure if you have some deeper problem in your application code, so there's always the risk of other problems popping up. If you continue to have problems, please show us a runnable test case so we can see what's actually going on and whether there's a legit bug or an invalid usage issue to resolve

    Thanks
    Isomorphic Software

    Comment

    Working...
    X