Hi All,
I'm trying to do something very basic with ajax. I simply want a value
to increment when an onchange event is triggered for another component.
The listener is being called via ajax etc. but I cannot get my component
to update. I understand I'm missing the logic which identifies and
updates the component, but have no idea where I need to do it, or what I
need to do.
I have my counter component 'AjaxCount' and my page 'AjaxDemo'.
Hopefully the code explains what I'm trying to do:
The error I'm getting:
"No node could be found to update content in with id counter"
AjaxCount.html:
<h1>Update Count</h1>
<p><span jwcid="@Insert" value="ognl:count">5</span></p>
AjaxCount.java:
@ComponentClass(allowInformalParameters = false)
public abstract class AjaxCount extends ApplicationComponent
{
private int count;
public int getCount()
{
return count;
}
public void setCount(int count)
{
this.count = count;
}
public void increment()
{
setCount(getCount() + 1);
}
}
AjaxDemo.java:
public abstract class AjaxDemo extends ApplicationPage implements
PageBeginRenderListener
{
@InjectComponent("counter")
public abstract AjaxCount getCounter();
@EventListener(targets = "A", events = "onchange", submitForm = "form")
public void changeA(IRequestCycle cycle)
{
System.out.println("changeA()");
modelB = this.getModelB();
AjaxCount counter = getCounter();
counter.increment();
cycle.getResponseBuilder().updateComponent("B");
cycle.getResponseBuilder().updateComponent("counter");
}
...
}
AjaxDemo.html:
...
<span jwcid="[EMAIL PROTECTED]"/>
...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]