0

How to detach a Window in a Iframe?

asked 2016-11-24 07:14:12 +0800

hubin gravatar image hubin
24 1

There is a Ifarme in my parent Window,and In the Iframe there are a master Window and a child Window which is created by createComponents method,how can I close the child Window in parent Window's java bind code?

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2016-11-25 02:18:44 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2016-11-25 02:23:12 +0800

At first I'd suggest to reconsider the usage of an iframe. If not necessary you can avoid this extra complexity. As I understand both your parent and child frame are part of the same application <include src="childPage.zul"/> sounds fair enough.

However if there's an strong need for an <iframe>: In principle you cannot access components directly inside an iframe as they belong to another desktop and you need to communicate via event queues as described here: https://www.zkoss.org/wiki/ZKComponentReference/EssentialComponents/Iframe#RetrievingComponentinsideIframe. If not using ZK EE you'll have to enable server push in the iframe in order to access and update components from another thread.

Since there are many "windows" in your description it's hard to give you the answer you need. In order to help you I'd like to ask you to provide a simplified running example. e.g. on http://zkfiddle.org/ Also please explain what you mean by "bind code"? I assume this will become obvious in your example.

Robert

link publish delete flag offensive edit

Comments

"bind code" means the parent window's viewModel(java class).

hubin ( 2016-11-25 07:31:48 +0800 )edit

ok that clarifies the last question. how about an example?

cor3000 ( 2016-11-28 01:25:32 +0800 )edit

http://zkfiddle.org/sample/2hm9pho/26-Iframe-detach-exception

hubin ( 2016-11-28 07:45:36 +0800 )edit
0

answered 2016-11-25 07:38:08 +0800

hubin gravatar image hubin
24 1

"bind code" means the parent window's viewModel(java class).

link publish delete flag offensive edit
0

answered 2016-11-28 07:50:31 +0800

hubin gravatar image hubin
24 1

http://zkfiddle.org/sample/2hm9pho/26-Iframe-detach-exception

There is the example. first click "add" button,create a pop window,then click "exit" button,I want to close pop window in the "exit" button's onclick event.

link publish delete flag offensive edit
0

answered 2016-11-28 08:41:17 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2016-11-28 08:42:27 +0800

Hi Hubin,

I updated your example to show how this can be done using a session scoped event queue.

http://zkfiddle.org/sample/2hm9pho/28-Iframe-detach-exception

Still I don't see any reason why you would want to use an iframe for this example. If there's no strong reason for this you can avoid all this overhead by simply using an <include> instead of the <iframe> -> It will both save network traffic and server side memory - and of course avoid the session scoped event queue overhead.

Robert

link publish delete flag offensive edit

Comments

Thanks a lot.this is designed by an dimission engineer, these code maybe involved much ,and the program has run a long time,so I don't want to alter it. Anyway ,thank you again for your help.

hubin ( 2016-11-29 01:36:30 +0800 )edit

you're welcome

cor3000 ( 2016-11-29 02:51:00 +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

Follow
1 follower

RSS

Stats

Asked: 2016-11-24 07:14:12 +0800

Seen: 40 times

Last updated: Nov 28 '16

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