Hi,
I created an HTMLPane to show some simple HTML (a preview of an invoice).
The HTMLPane was in a Window, which was shown by a button.
My client then requested that the HTMLPane show up on a section canvas instead.
So I added it to the section canvas as well.
But I wanted to keep the button / window, since it’s able to show more.
When I click the button, it disappears from the section canvas, and appears in the window. But it will then not appear in the canvas again.
Is an object only allowed one parent container at a time?
In order to have it appear in both places, do I need to instantiate 2 separate HTMLPanes?
Thanks,
Mike
Yes, a component can only be at once place at one time. Assuming you have not used contentsType:“page”, you can create a new HTMLPane with the same contents by just calling getContents() on the original.
Hi,
- Can you clarify a little on what you mean by calling getContents() on the original?
For now I created two separate panes, which works fine, albeit 2 trips to the server for HTML.
- If I maximize the parent window, the HTMLPane “embedded” in the section canvas does not expand to fill the now bigger section . It retains its original size, though I specified 100% height and width.
However, as soon as I adjust any of the dividing bars, it fixes itself. Is there a way for this to happen automatically when the user maximizes the window?
Thanks,
Mike
-
literally call getContents() on the HTMLFlow that originally loaded the content. This will provide an HTML String that you can provide as htmlFlow.contents to the second HTMLFlow, so that you don’t have to reload the content.
-
check the Watch tab to determine if the HTMLFlow is actually filling the parent’s space. Most likely, it is, but the HTML content you are providing is not set up to stretch to fill the HTMLFlow.
This could also happen if you are using contentsType:“page”, which we generally recommend against.
Thanks…I’ll switch from “page” to “fragment”.
I assumed I needed to use page, because my PHP script was pumping out a full html page. But I can easily adjust the PHP to output a fragment instead, which will make things easier on the SC side.
Mike