layout.cell.attachUrl dock(), undock() Cannot set property 'onload' of null

Use attachurl, undock () has no problem, but dock () throws an error.

How do you solve it?

error

Please, try to call the dock() from the onContentLoaded event:
https://docs.dhtmlx.com/layout__attach_urls.html#usingoncontentloadedevent
If the problem still occurs for you please, provide a complete demo or a demo link, where the problem can be reconstructed locally.