Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
What I am hoping to do is something like this:
<span jwcid="@For" value="ognl:current">
<a jwcid="foo"><span jwcid="@Insert" value="ognl:current"/></a>
<span jwcid="@InvokeListener" listener="listener:makeLink"/>
</span>
and code like this:
public void makeLink() {
IEventListener listener = getFoo().getEventListener("onclick");
listener.setEventHandler("bar");
listener.setParameters(new Object[]
);
}
// called when user clicks on one of the generated links in @For
public void bar(Long entityId)
Hope that helps...
CD suggested this:
I found a nice solution using dojo's ability to listen to an arbitrary
javascript function as if it were a native event.
I attach an empty js function to an arbitrary DOM element like this:
document.getElementById('someDiv').clickRadio=function(radio) {};
and an onclick attribute to my radio buttons:
<span jwcid="@Radio" value="ognl:lv.value" onclick="document.getElementById
('someDiv').clickRadio(this);"/>
Then I can set an EventListener on the server-side
@EventListener(targets = "someDiv", events = "clickRadio", submitForm =
"form")
public void listenToOnclickOnAnyRadioButtonInTheForLoop(IRequestCycle
cycle) throws InterruptedException
Works fine.
Ch.