Spreadsheet: lock cells on initialization

Is there a way to lock cells when initializing the spreadsheet? I would prefer to do that than having to execute some API code to lock the cells after everything has loaded.

Hello, @mtsrfndave

To lock cells in the spreadsheet is possible with lockCell method.

The most suitable event reflecting the general “readiness” of the component is onAfterLoad. It fires after data loading is complete, but not after rendering specifically.
Here is the snippet Code Snippet

If for some specific reason you need to lock cells during the initial rendering, you could proceed as follows:

  • first via $$ get subview of cells ($$("ss").$$("cells"))
  • then use onAfterRender to catch the rendering moment and apply lockCell.

Please, pay attention, that lockCell calls a datateble refresh, onAfterRender, in turn, is triggered for every update. That means that it’s possible to get into an endless loop. To avoid this loop, you could use once. Please, check the snippet here: Code Snippet . Also, it’s possible to block and then unblock events. Here is the snippet: Code Snippet