answered
2022-10-14 18:30:23 +0800
MDuchemin 2480 ● 1 ● 6
your include has the vlfex and hflex attributes, which means that it will size up to the available parent's size.
Regarding finding out what it will calculate up to will require a few steps, since ZK doesn't usually keep track of client-side sizes.
There are a number of reasons for that. First, that would require keeping track of a lot of different components sizes. Second, these sizes can change pretty much anytime. This said, you can set the onAfterSize event to tell the component to retrieve its size and send it back to the server.
You can use the onAfterSize event to receive an event anytime the component is resized (including when it is created initially)
https://zkfiddle.org/sample/1sj1h1b/4-size-request-composer
sample asking for width, but you can get other data from the event as well.
See the afterSize event for details on that:
https://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/event/AfterSizeEvent.html
Alternatively, you can execute arbitrary JavaScript targeting a component of your choice if the info you need is not available in the onAfterSize event, such as retrieving the full client rects.
I've put a sample below, but that's just to illustrate the order of operations, and not what I would actually recommend doing:
https://zkfiddle.org/sample/1sj1h1b/3-size-request-composer
(declare an arbitrary script, use Clients.evalJavaScript to trigger it, send a custom event back, and lastly listen to the custom event).