How to preserve old content when setting content of ContentPane
-
31-05-2021 - |
Pergunta
Apparently Dojo does some clean-up when setting the content
property of a ContentPane. For example: if I set content
to widget A, then set content
to widget B, widget A's domNode
is null'ed out. I'd like to set content
back to widget A, but the ContentPane is filled with "undefined" because widget A's domNode
was cleaned up.
Any way to prevent the ContentPane's old content from being cleaned up? Or is there a method to swap different widgets in a ContentPane without using setContent()
or set('content', ...)
?
Solução
Use a StackContainer
for the content and then add each widget to the stack.
http://dojotoolkit.org/reference-guide/1.7/dijit/layout/StackContainer.html
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow