0

How to apply HTML element attribute to ZK element?

asked 2010-10-11 10:06:04 +0800

blin gravatar image blin
45 3

Hi All,

I'd like to apply attribute "unseletable" which is an HTML element property (e.g. <span unseletable="on">) to ZK element "listbox". I tried to mix html tag into .zul by using <h:div unseletable="on"> around the listbox, but it doesn't work. It only works around pure text.

The attribute "unseletable" is used in IE to turn off the selection of the text in browser. My goal is to turn off the selection of text in my listbox. If anyone has experience in applying html attributes to ZK elements, I would really appreciate if you could give me some advice.

Thanks in advance!

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-10-17 20:45:15 +0800

samchuang gravatar image samchuang
4084 4

Hi

here is a workaround

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk xmlns:w="client">
<style>
	.z-listcell-cnt {
		-moz-user-select: none;
        -webkit-user-select: none;
	}
</style>
	<listbox>
		<attribute w:name="onBind">
			var chd = jq(this.$n()).find('.z-listcell-cnt').each(function (index, node) {
				jq(node).attr('unselectable', 'on'); //for IE
			});
		</attribute>
		<listhead>
			<listheader label="header" sort="auto" />
		</listhead>
		<listitem>
			<listcell label="Cell 1"/>
		</listitem>
		<listitem>
			<listcell label="Cell 2" />
		</listitem>
	</listbox>
</zk>

link publish delete flag offensive edit

answered 2010-10-18 07:59:08 +0800

blin gravatar image blin
45 3

Thank you so much for the help and it works!!! :-)

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-10-11 10:06:04 +0800

Seen: 446 times

Last updated: Oct 18 '10

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