How to recalculate/redraw components via Javascript?

asked 2019-08-22 16:58:31 +0800

tisaksen gravatar image tisaksen
46 6

I have a page where I am hiding a sidebar.. however, the rest of the layout is "stuck" until I resize the browser window or toggle the bookmark bar, etc to change the size of the canvas. I think I have to 'force' ZK to recalculate the layout to get around this. How would I do this?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2019-08-22 18:42:19 +0800

MDuchemin gravatar image MDuchemin
2390 1 6
ZK Team

What kind of sidebar / layout sizing are you using?

There is a way to tell widgets (JS object representing components on client side) to recalculate size. if you want to tell a widget to check for size, just use


As for getting the component instance, just refer to the zk.$() (or zk.Widget.$() ) syntax: https://www.zkoss.org/javadoc/latest/jsdoc/zk/Widget.html#Z:Z:D-zk.Object-global.Map- you can retrieve from a DOM node, a component id, etc..

link publish delete flag offensive edit

answered 2019-08-22 19:24:10 +0800

tisaksen gravatar image tisaksen
46 6

Lovely! Exactly what I was looking for.

I am just using CSS (gridlayout) to do the sidebar and controlling it with Javascript.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2019-08-22 16:58:31 +0800

Seen: 14 times

Last updated: Aug 22 '19

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More