Skip to main content Skip to footer

Quick Tip to Improve Performance: Use FlexSheet's deferUpdate Method

Many operations in FlexSheet—such as adding a new sheet, setting cell data, etc.—will refresh the FlexSheet. Multiple operations lead to multiple refreshes, which will eventually lead to a slower performance. FlexSheet's deferUpdate method ensures that FlexSheet will not refresh until all its included operations have been applied. As the FlexSheet will be refreshed only once, the performance of the FlexSheet will be improved. For example: If we add 25 sheets into the FlexSheet without the deferUpdate method, it needs more than 30 seconds to finish all the adding sheet operations. If we put all the adding sheet operations into the deferUpdate like following code snippet, it only needs about 0.8 seconds!

flexSheet.deferUpdate(function(){  
flexSheet.addBoundSheet(‘sheet1’, data1);  
flexSheet.addBoundSheet(‘sheet2’, data2);  
….  
flexSheet.addBoundSheet(‘sheet25’, data25);  
});

All Wijmo controls include the deferUpdate method. It's important to keep it in mind when doing any large operations or frequent updates to our controls. It's most commonly used in things like FlexGrid and FlexSheet, but is applicable almost anywhere with these conditions.

Try the fiddle to compare performance >>

Learn more about deferUpdate >>

MESCIUS inc.

comments powered by Disqus