0

How can I access a component of another window?

asked 2010-08-22 19:41:25 +0800

newguy2010 gravatar image newguy2010
36

I know this is a newbie question but it's hard to find any documentation associated with that.
I have two windows in my app. They both use the same controller. Now I want to click on a button of one window and display some value in a textbox of another window. How can I do this? Is there a pattern I can use?
I've tried to put the textbox as an autowired component but it seems it couldn't find that component which is in another window.

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2010-08-22 22:17:32 +0800

TonyQ gravatar image TonyQ
642
https://www.masterbranch....

Could you provide zul to clarify the problem ? ^^

link publish delete flag offensive edit

answered 2010-08-22 23:46:22 +0800

newguy2010 gravatar image newguy2010
36

<window id="A1" apply="MyController">
   <button id="B"></button>
</window>
<window id="A2" apply="MyController">
   <textbox id="C"></textbox>
</window>

What I want to do is click button B and change the value of textbox C. How can I do that?

link publish delete flag offensive edit

answered 2010-08-22 23:56:27 +0800

mitiqi gravatar image mitiqi
27

you can access it with javascript jq('$A2 $C');

link publish delete flag offensive edit

answered 2010-08-23 00:16:40 +0800

newguy2010 gravatar image newguy2010
36

what if I want to set the value on the server side?

link publish delete flag offensive edit

answered 2010-08-23 03:38:04 +0800

TonyQ gravatar image TonyQ
642
https://www.masterbranch....

You could try this statement in controller to get C .

Path.getComponent("/A2/C")  

link publish delete flag offensive edit

answered 2010-08-23 11:10:06 +0800

robertpic71 gravatar image robertpic71
1275 1

Some notes/variants:

1.) Use the absoulte path (as TonyQ wrote)

2.) You could avoid (inline) window and use components without own namespace (div, panel, groupbox..)

3.) Mixed with java, you could use autowired utitiy.
i.e. use an GenericForwardComposer for the root UI-Namespace
and add the subnamespaces via
Components.wireVariables(a2, rootComposer); //

/Robert

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2010-08-22 19:41:25 +0800

Seen: 451 times

Last updated: Aug 23 '10

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