You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by javax <ja...@gmail.com> on 2010/12/22 21:16:53 UTC
Calling javascript from AjaxCheckBox
Hi, I'm trying to call javascript function on AjaxCheckBox selection.
Tried both in 1.4 and 1.5 by overriding protected IAjaxCallDecorator
getAjaxCallDecorator()
This approach works well for AjaxLink and AjaxButton, but for AjaxCheckBox
execution even not arrives to
decorateScript(Component component, CharSequence script) {
How can I do it?
Thank you
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Calling-javascript-from-AjaxCheckBox-tp3161184p3161184.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Calling javascript from AjaxCheckBox
Posted by Martin Grigorov <mg...@apache.org>.
Try harder ;-)
This is not how AjaxLink code looks like.
On Thu, Dec 23, 2010 at 7:27 AM, javax <ja...@gmail.com> wrote:
>
> Thank you, I tried to take code from AjaxLink - the same result:
>
> public abstract class PropertyCheckBox extends CheckBox {
> private static final long serialVersionUID = 1L;
>
> public PropertyCheckBox(final String id) {
> this(id, null);
> }
>
> public PropertyCheckBox(final String id, final IModel<Boolean> model) {
> super(id, model);
>
> setOutputMarkupId(true);
>
> add(new AjaxEventBehavior("onclick") {
> private static final long serialVersionUID = 1L;
>
> protected void onUpdate(AjaxRequestTarget target) {
> PropertyCheckBox.this.onUpdate(target);
> }
>
> @Override
> protected IAjaxCallDecorator getAjaxCallDecorator() {
> return new IAjaxCallDecorator() {
> public CharSequence decorateScript(Component component,
> CharSequence script) {
> return script;
> }
>
> public CharSequence decorateOnSuccessScript(Component
> component, CharSequence script) {
> return script;
> }
>
> public CharSequence decorateOnFailureScript(Component
> component, CharSequence script) {
> return script;
> }
> };
> }
>
> @Override
> protected void onEvent(AjaxRequestTarget target) {
> onUpdate(target);
> }
> });
> }
>
> protected abstract void onUpdate(AjaxRequestTarget target);
> }
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Calling-javascript-from-AjaxCheckBox-tp3161184p3161674.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Calling javascript from AjaxCheckBox
Posted by javax <ja...@gmail.com>.
Thank you, I tried to take code from AjaxLink - the same result:
public abstract class PropertyCheckBox extends CheckBox {
private static final long serialVersionUID = 1L;
public PropertyCheckBox(final String id) {
this(id, null);
}
public PropertyCheckBox(final String id, final IModel<Boolean> model) {
super(id, model);
setOutputMarkupId(true);
add(new AjaxEventBehavior("onclick") {
private static final long serialVersionUID = 1L;
protected void onUpdate(AjaxRequestTarget target) {
PropertyCheckBox.this.onUpdate(target);
}
@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new IAjaxCallDecorator() {
public CharSequence decorateScript(Component component,
CharSequence script) {
return script;
}
public CharSequence decorateOnSuccessScript(Component
component, CharSequence script) {
return script;
}
public CharSequence decorateOnFailureScript(Component
component, CharSequence script) {
return script;
}
};
}
@Override
protected void onEvent(AjaxRequestTarget target) {
onUpdate(target);
}
});
}
protected abstract void onUpdate(AjaxRequestTarget target);
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Calling-javascript-from-AjaxCheckBox-tp3161184p3161674.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Calling javascript from AjaxCheckBox
Posted by Martin Grigorov <mg...@apache.org>.
It seems AjaxCheckBox doesn't support that out of the box.
Create a RFE in Jira.
In the meantime you can create your own component that supports that.
See how AjaxLink delegates the behavior call to its own
#getAjaxCallDecorator()
On Wed, Dec 22, 2010 at 9:16 PM, javax <ja...@gmail.com> wrote:
>
> Hi, I'm trying to call javascript function on AjaxCheckBox selection.
> Tried both in 1.4 and 1.5 by overriding protected IAjaxCallDecorator
> getAjaxCallDecorator()
>
> This approach works well for AjaxLink and AjaxButton, but for AjaxCheckBox
> execution even not arrives to
> decorateScript(Component component, CharSequence script) {
>
> How can I do it?
>
> Thank you
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Calling-javascript-from-AjaxCheckBox-tp3161184p3161184.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>