Announcement

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

    Patch needed for addImplicitSort

    Hello,

    I'm evaluating the new sortByGroupFirst method and found a bug and developed a patch.

    The issue manifests when you load a saved view state that is grouped by a custom formula. Then, you switch to a new view state where that custom formula is not a known field. A simple null check in addImplicitSort seems to correct this problem.

    Can you add this null check on your side?


    Code:
    	//9/15/14..patch for missing null check on implicitSort
    	if (window.isc &&  (isc.version.startsWith("v10.0")  )){
    		
    		isc.ListGrid.getPrototype().addProperties({
    			$1444:function isc_ListGrid__addImplicitSort(_1){
    				var _2=false,_3=this.getGroupByFields()||[],_4=isc.shallowClone(_1);
    				if(this.sortByGroupFirst&&!_3.isEmpty()){
    					this.logInfo("Evaluating implicit sort for grouping "+isc.echoAll(_3),"sorting");
    					var _5=_1.isEmpty()?"ascending":_1[0].direction;this.$1445=this.groupSortDirection||this.$1445||_5;
    					
    					for(var i=0;i<_3.length;i++){
    						var _7=_3[i];
    						if(_1.find("property",_7)){
    							this.logInfo("Existing sort specifier found for property '"+_7+"'.  Skipping.","sorting");
    							continue
    						}
    
    						var _8=this.getUnderlyingField(_7);
    						
    						//9/14/14
    						//ignore if field can't be found
    						//this happens when switching between a view state grouped by a custom formula and
    						//another view where that custom formula is not a defined field
    						if(_8==null){
    							continue;
    						}
    						var _9={sortedImplicitly:true,context:this,normalizer:this.$1446(_8),property:_7,direction:this.$1445}
    
    						_4.addAt(_9,i);_2=true}
    					}
    
    					if(_2){
    						this.logInfo("Returning augmented sort specifiers"+isc.echoAll(_4),"sorting")
    					}else{
    						this.logInfo("Returning unmodified sort specifiers"+isc.echoAll(_4),"sorting")
    					}
    					return _4
    			}
    		}
    		
    	}

    #2
    We've added the logic as you suggest. This will be present in nightly builds going forward (Sep 17 and above)

    Regards
    Isomorphic Software

    Comment

    Working...
    X