-
FEATURED COMPONENTS
First time here? Check out the FAQ!
When I try to do binding on custom attribute, like:
<button id="button" ..>
<custom-attribute item="@{item}"/>
</button>
and when I try to retrieve the value, like
button.getAttribute("item")
I get the string literal "@{item}" instead of the bounded expression's value. What am I missing here?
Databinding for customattributes is working since ZK Version 5.
Post your code (zul) if you have any troubles.
/Robert
I have the same problem
<button id="deleteAddressBtn" label="-" >
<custom-attributes deleteAddress="@{address}" />
</button>
and in Composer
...
public void onClick$deleteAddressBtn(Event e) throws InterruptedException{
Address addr=(Address)deleteAddressBtn.getAttribute("deleteAddress");
Messagebox(addr.street);
}
address in view is valorized but the attribute is null
can anyone help me?
Thanks
You have to retrieve the "fired button" first.
onClick$delteAdressBtn(Event e) {..
Component comp = event.getTarget()); // retrieve the target component --> clicked(!) button
Address addr=(Address)comp.getAttribute("deleteAddress");
Note 1: with getParent() you could retrieve Row/Listitem and you don't have to bind data for all buttons.
Note 2: @databinding for custom-attributes works since ZK 5.x
/Robert
Component comp = event.getTarget()); // retrieve the target component --> clicked(!) button Address addr=(Address)comp.getAttribute("deleteAddress");
not run!
I don't know why but in debugging the comp contain a window that contain grid with button in row, not the button
PS: I have a 5.0.x
I resolved with
public void onClick$deleteAddressBtn(ForwardEvent e) throws InterruptedException{ Component comp=e.getOrigin().getTarget(); Address addr=(Address)comp.getAttribute("value"); }
I hope this is usefull for others
Thanks for help
Asked: 2009-09-10 18:35:29 +0800
Seen: 807 times
Last updated: Feb 22 '11