Announcement

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

    markRecordRemoved question

    Hello,

    I'm trying to write a grid function that lets the user mark a group of records that contain a certain value as removed. But, the performance is very slow in my tests. I'm trying to use the suppressRefresh param that appears to be undocumented but is used by grid.markSelectionRemoved() but it is not helping performance. In my tests, it is taking 6-8 seconds to mark about 50 grid records as removed. Here is the function I am using. Any idea why this would be so slow with Smartclient 9.1 and Chrome 35 on Windows 7?

    Code:
    function gridMarkRecordsAsRemoved(grid,property,propertyValueToRemove){
    	
    	var refreshGrid=false;
    	var dataSet = getGridDataSet(grid);
    	if(dataSet!=null){
    		var j = dataSet.getLength();
    		for (var i = 0; i < j; i++){
    			
    			var record = grid.getRecord(i);
    			
    			if(record[property]!=null && record[property]==propertyValueToRemove){
    				//isc.Log.logInfo("in gridMarkRecordsAsRemoved, for record.ticker=" + record.ticker + " calling markRecordRemoved")
    				//calling markRecordRemoved but setting suppressRefresh to true
    				grid.markRecordRemoved(i,true);
    				refreshGrid=true;
    				//isc.Log.logInfo("in gridMarkRecordsAsRemoved, for record.ticker=" + record.ticker + " DONE calling markRecordRemoved")
    
    			}
    		}
    
    	}
    	
    	if(refreshGrid){
    		//isc.Log.logInfo("gridMarkRecordsAsRemoved, calling grid.markForRedraw")
    		grid.markForRedraw();
    		//isc.Log.logInfo("gridMarkRecordsAsRemoved, DONE calling grid.markForRedraw")
    
    	}
    	
    	
    }

    #2
    Try your code on any grid sample - it executes instantly. We suspect you've got some logic in your particular grid (such as formatters, handlers for selection change, styling overrides, etc) that ends up executing a lot as a result of marking a record removed.

    Comment


      #3
      I discovered the issue running the Profile in Chrome Developer Console. The multi-line grid summaries and group summaries are recalculating for every iteration through my loop of records even though suppressRefresh is true.

      I am working around this problem in my method by turning off summaries and executing the logic and then turning summaries back on. However, you may want to consider reviewing this for your markSelectionRemoved() method because it is negatively impacting performance when group and grid summaries are turned on and there are multi-line summaries.

      Comment


        #4
        We've fixed the issue of the summaries being recalculated when markRecordRemoved() is called. You shouldn't actually even need to use the hidden argument to avoid this. However, you will need to explicitly request when you do want them recalculated, as you cannot rely on markForRedraw() to achieve it.

        Use the recalculateSummaries() method to request an explicit recalculation: http://www.smartclient.com/docs/9.1/...ulateSummaries

        The change will be applied to applied to SC 9.1p and 10.0d. For 9.1p you'll need to wait for the 7/10/2014 nightly build.

        Comment

        Working...
        X