Posted 8 September 2017, 10:09 am EST
HEllo,
Most SpreadJS APIs are designed to automatically invalidate and update the relevant parts of the control when called.
In some cases, particularly when using loops to iterate many cells or ranges to set some change, or just applying many sequential changes in a function, this can cause performance issues when each change is updated immediately.
So you can use suspendPaint() to temporarily suspend the automatic invalidate and update for each change and optimize the performance of loops or large blocks of code.
InvalidateLayout deletes the current cached layout and forces the layout to be recalculated when the sheet or workbook is painted again; in code you can use invalidateLayout together with repaint to force the layout to be recalculated after some operation which will affect the layout. For example, if you implement code to filter rows or collapse a range group, then the layout of the cells will change; to query the cell rectangle using getCellRect for some cell affected by the change would require using invalidateLayout and repaint methods between the logic which affects the layout and the code calling getCellRect.
Refresh method will make the control resize if necessary (can recompute layout in that case) and repaint its contents; repaint method will use current layout to repaint the content.
Reset method will remove all settings in the sheet (values, formulas, styles, etc.). You can use this method to clear everything from the sheet and recycle an instance of Sheet instead of creating a new instance.
If you are using a lot of formulas, then the method suspendCalcService can be used to optimize recalculation for cases where many formulas are set in code at once. Normally formulas are calculated immediately when set, but using suspendCalcService you can temporarily disable that until after all your formulas are set, then calculate all at once:
http://sphelp.grapecity.com/webhelp/SpreadSheets10/webframe.html#JavascriptLibrary~GC.Spread.Sheets.Workbook~suspendCalcService.html
http://sphelp.grapecity.com/webhelp/SpreadSheets10/webframe.html#JavascriptLibrary~GC.Spread.Sheets.Workbook~resumePaint.html
You can try using suspendPaint( ) method for that matter as given in links below. And also there are two pair of functions which may be used to improve bunch value operations performance and they are:- suspendCalcService(), resumeCalcService(), suspendEvent(), resumeEvent()
http://sphelp.grapecity.com/forums/topic/sheet-suspendcalcservice-and-resume-copy-problem/
Hope it helps.
Thanks,
Reeva