0

Server side retrieval of the currently rendered html for a certain component

asked 2012-02-03 09:12:25 +0800

cvarona gravatar image cvarona
554 1 6

Hi there,

I'd like to know whether there is some way to obtain the html generated for a given component, say a window, from the server side.

With kind regards

César Varona

delete flag offensive retag edit

2 Replies

Sort by » oldest newest

answered 2012-02-09 07:05:17 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

Hi Varona,

You can try to send it to server side from client side, for example,
the fragment below will show the window's html in server console

<zk>
	<script type="text/javascript">
		function getHtml(id) {
			var node = jq('#'+id)[0],
				div = document.createElement('div'),
				$tmp = jq('$tmp'),
				tmp = $tmp[0];
			div.appendChild(node.cloneNode(true));
			$tmp.focus();
			tmp.value = div.innerHTML;
			$tmp.blur();
			tmp.value = '';
		}
	</script>
	<window id="win" title="test win" />
	<textbox id="tmp" onChange="System.out.println(event.getValue());" visible="false" />
	<button label="show window html in console">
		<attribute name="onClick">
			Clients.evalJavaScript("getHtml('"+win.getUuid()+"');");
		</attribute>
	</button>
</zk>

Regards,
ben

link publish delete flag offensive edit

answered 2012-02-09 10:07:16 +0800

cvarona gravatar image cvarona
554 1 6

Thanks a lot for this, it rocks!

César Varona

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: 2012-02-03 09:12:25 +0800

Seen: 157 times

Last updated: Feb 09 '12

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