Hi mxc
mxc escribió:
Hi all,
I cant get dojo EventListener to work. I am trying to build a drop down
combo box so that when one selects a country the child drop down box of
cities is automatically updated. However I cant get even a simple
eventlistener to work :(
Below is my TestPage. Basically it should update the element id="output"
when a click event occurs on the element id="testbutton"
I can see from the debug output that the event is being fired but the update
never occurs. :(
TestPage.html
==================================
<html jwcid="@MainFrame" title="Wazzup - List Regions" heading="Regions
List">
You have to use @Shell and @Body component in html and body tags, to
dojo works.
<div id="testbutton">Click Me</div>
<div jwcid="[EMAIL PROTECTED]">
Test
</div>
Maybe use jwcid="@Insert" and a value="ognl:output", and make an output
variable and getOutput method on the java.
</html>
MainFrame.html
=======================
<?xml version="1.0"?>
<html jwcid="@Shell" title="ognl:title" ajaxEnabled="true"
browserLogLevel="DEBUG">
<body jwcid="@Body">
<div style="float:left">
<table>
<tr><td> # Test Page </td></tr>
</table>
</div>
<div><h1>Some Heading Here</h1></div>
<div jwcid="@RenderBody">Some Content Here</div>
</body>
</html>
TestPage.java
================
public abstract class TestPage extends BasePage {
public abstract void setTestText(String text);
public abstract String getTestText();
@EventListener(elements = "testbutton", events = "onclick")
public void changeText(IRequestCycle cycle, BrowserEvent event)
{
setTestText("Help");
cycle.getResponseBuilder().updateComponent("output");
}
}
It's Ok, but it's seems that you aren't changeing the correct component.
Make an @Insert better an update de variable, and then an
updateComponent that's shows the new value of the variable.
Cheers
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]