width binding in window

asked 2013-11-25 21:40:17 +0800

daovallec gravatar image daovallec
11 2

I have a window like:

<window id="camp" border="0" apply="org.zkoss.bind.BindComposer" 
        viewModel="@id('vm') @init('com.app.viewModel.cpp.MainCpp')"
                    <include src="/com.app.web.menu/north.zul" />


And i need spicify a width to the Window, but i need the width depending of a number in my model.

 public class MainCpp {
 int num = mmDAO.getnum();
  //Getter and Setter
 //Some Methods

Then i need the width = "num px" of my window camp;

When my view is open,

How can i do it?

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted

answered 2013-11-26 12:48:54 +0800

sarco gravatar image sarco flag of Spain
93 6

updated 2013-11-26 12:52:45 +0800

String getNumPx(int num){ String snum = num + "px"; return snum; }

Try: width="@load(vm.numPx)"

link publish delete flag offensive edit

answered 2017-03-27 02:03:53 +0800

cor3000 gravatar image cor3000
6280 2 7

here an example showing how to load the width from a view model, and (optionally) receive onAfterSize events to update the value in the view model after a user or the browser resized the window.


feel free to update the example in order to demonstrate what you really need.

link publish delete flag offensive edit

answered 2013-11-26 10:40:43 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8

What you have tried so far ? Use @Bind with width attribute

link publish delete flag offensive edit


@bind is for bi-directional binding (combined @load and @save) ... it doesn't make sense on the width property if the value is specified in the view model.

cor3000 ( 2017-03-27 01:46:20 +0800 )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

1 follower



Asked: 2013-11-25 21:40:17 +0800

Seen: 44 times

Last updated: Mar 27 '17

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