Render and Cache
Purpose
ZK Spreadsheet provide various setting for render and cache. Optimal values could be provided for achieve maximum performance.
Client Cache
Use client cache will improve performance when user switch between sheet.
ZK Spreadsheet enable cache by default. To disable cache, use Spreadsheet.setClientCacheDisabled
Max Rendered Cell Size
ZK Spreadsheet loads cell data and also prunes invisible cells (DOM Elements) as well when users scroll sheet. The default setting is 8000, meaning client side will prune cells only when total cell number is more then 8000.
Ideally, if browser in client side could support enough memory space, pruning no cells would provide faster response time; since there is no need to re-create all loaded cells. However, there is always limitation in browser. If the number of loaded cells is outnumbered than what browser could handle, browser may become slow and unstable.
Set proper size by Spreadsheet.setMaxRenderedCellSize
Preload Size
ZK Spreadsheet load cell data base on preloadRowSize/preloadColSize attribute when load sheet and scrolling.
In theory, increasing preload size will improve response time. Since cell data has been preloaded, there is no need to send request back to server again; thus it also decrease the number of client/server communication. However, if preload size is outnumbered than needed, client side may need extra CPU time to process those extra data. For example, with a screen display which can show 50 rows * 30 columns, setting preload size to 500 rows * 300 columns will simply waste a lot of CPU time in client side to process those extra invisible cells.
Set proper preload size base on sheet's data size by Spreadsheet.setPreloadRowSize and Spreadsheet.setPreloadColumnSize
ZUML
<zk>
<window vflex="1" width="100%">
<spreadsheet
clientCacheDisabled="false"
maxRenderedCellSize="15000"
preloadColumnSize="60"
preloadRowSize="80"
id="spreadsheet" vflex="true" width="100%" showSheetbar="true"
src="/WEB-INF/excel/config/ZSS-demo_sample.xlsx" maxcolumns="100" maxrows="1000"
></spreadsheet>
</window>
</zk>
View complete source of ZUML renderAndCache.zul
Version History
Version | Date | Content |
---|---|---|
2.3.0 | April, 2012 | Client cache/Max Rendered Cell Size |
All source code listed in this book is at Github.