-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I want to know if there is a way to add a custom attribute to an html tag that is createad by zk.
For example if I use a TextBox and I do something like this:
TextBox tb = new TextBox(); tb.setAttribute("myAttr","myValue");
I would like to have in the generate html code something like this:
<textarea myAttr="myValue">
The custom attributes in ZK are server side attributes. You can only retrieve them on the server. If you need something on the client you will have to either extend the javascript that ZK gives or use some of the non UI related attributes. For example I use zclass attribute to stuck in some information for the client.
You can even try the jQuery option of adding attributes after the components are mounted. Try the following:
zk.afterMount(function() {
jq("$txtBoxId").attr("myAttr", "myValue");
});
The above will add an attribute to the client after the components are mounted to zk system.
HTH
-kesav
Asked: 2010-01-08 09:17:26 +0800
Seen: 727 times
Last updated: Jan 08 '10