You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by alexandre ricciardi <al...@gmail.com> on 2016/04/20 17:23:42 UTC

AjaxCheckBox ListView Bug

Hello,


I want to update a dropdown list with ajax calls triggered by checkboxes.
I have a ListView of AjaxCheckBoxes but only the first AjaxCheckBox is
callbacked.
It appears that all ajax calls are triggered by the first check box.
Changing the following checkboxes have not effect.

DropDownChoice<String> ddc = new DropDownChoice<String>("ddcName",
listProps);
ddc.setOutputMarkupId(true);
add(ddc);

final IModel<ValueMap> thisModel = getModel();
ListView<LauncherModule> listModules = new
ListView<LauncherModule>("list.module.beans",
PluginsConfigHelper.getModules()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<Module> item) {
AjaxCheckBox box = new AjaxCheckBox("myCheckBox", Model.of(Boolean.TRUE) {

private static final long serialVersionUID = 1L;

@Override
protected void onUpdate(AjaxRequestTarget target)
{ target.add(ddc); }

};
box.setOutputMarkupId(true);
box.setOutputMarkupPlaceholderTag(true);
item.add(box);
}
};

Thanks for your help.

Alexandre

Re: AjaxCheckBox ListView Bug

Posted by alexandre ricciardi <al...@gmail.com>.
Hi Sven,

This solves the problem, thanks a lot for your reply !

Regards,

Alexandre

Le mer. 20 avr. 2016 à 18:02, Sven Meier <sv...@meiers.net> a écrit :

> Hi,
>
> check your markup - you should not have an id in there:
>
> <input type="checkbox" wicket:id="myCheckBox"
> id="all_checkboxes_have_the_same_id"/>
>
> Have fun
> Sven
>
> On 20.04.2016 17:23, alexandre ricciardi wrote:
> > Hello,
> >
> >
> > I want to update a dropdown list with ajax calls triggered by checkboxes.
> > I have a ListView of AjaxCheckBoxes but only the first AjaxCheckBox is
> > callbacked.
> > It appears that all ajax calls are triggered by the first check box.
> > Changing the following checkboxes have not effect.
> >
> > DropDownChoice<String> ddc = new DropDownChoice<String>("ddcName",
> > listProps);
> > ddc.setOutputMarkupId(true);
> > add(ddc);
> >
> > final IModel<ValueMap> thisModel = getModel();
> > ListView<LauncherModule> listModules = new
> > ListView<LauncherModule>("list.module.beans",
> > PluginsConfigHelper.getModules()) {
> > private static final long serialVersionUID = 1L;
> > @Override
> > protected void populateItem(ListItem<Module> item) {
> > AjaxCheckBox box = new AjaxCheckBox("myCheckBox", Model.of(Boolean.TRUE)
> {
> >
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > protected void onUpdate(AjaxRequestTarget target)
> > { target.add(ddc); }
> >
> > };
> > box.setOutputMarkupId(true);
> > box.setOutputMarkupPlaceholderTag(true);
> > item.add(box);
> > }
> > };
> >
> > Thanks for your help.
> >
> > Alexandre
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AjaxCheckBox ListView Bug

Posted by Sven Meier <sv...@meiers.net>.
Hi,

check your markup - you should not have an id in there:

<input type="checkbox" wicket:id="myCheckBox" 
id="all_checkboxes_have_the_same_id"/>

Have fun
Sven

On 20.04.2016 17:23, alexandre ricciardi wrote:
> Hello,
>
>
> I want to update a dropdown list with ajax calls triggered by checkboxes.
> I have a ListView of AjaxCheckBoxes but only the first AjaxCheckBox is
> callbacked.
> It appears that all ajax calls are triggered by the first check box.
> Changing the following checkboxes have not effect.
>
> DropDownChoice<String> ddc = new DropDownChoice<String>("ddcName",
> listProps);
> ddc.setOutputMarkupId(true);
> add(ddc);
>
> final IModel<ValueMap> thisModel = getModel();
> ListView<LauncherModule> listModules = new
> ListView<LauncherModule>("list.module.beans",
> PluginsConfigHelper.getModules()) {
> private static final long serialVersionUID = 1L;
> @Override
> protected void populateItem(ListItem<Module> item) {
> AjaxCheckBox box = new AjaxCheckBox("myCheckBox", Model.of(Boolean.TRUE) {
>
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void onUpdate(AjaxRequestTarget target)
> { target.add(ddc); }
>
> };
> box.setOutputMarkupId(true);
> box.setOutputMarkupPlaceholderTag(true);
> item.add(box);
> }
> };
>
> Thanks for your help.
>
> Alexandre
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AjaxCheckBox ListView Bug

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Please try by calling listModules.setReuseItems(true);

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Apr 20, 2016 at 5:23 PM, alexandre ricciardi <
alexandre.ricciardi.reactis@gmail.com> wrote:

> Hello,
>
>
> I want to update a dropdown list with ajax calls triggered by checkboxes.
> I have a ListView of AjaxCheckBoxes but only the first AjaxCheckBox is
> callbacked.
> It appears that all ajax calls are triggered by the first check box.
> Changing the following checkboxes have not effect.
>
> DropDownChoice<String> ddc = new DropDownChoice<String>("ddcName",
> listProps);
> ddc.setOutputMarkupId(true);
> add(ddc);
>
> final IModel<ValueMap> thisModel = getModel();
> ListView<LauncherModule> listModules = new
> ListView<LauncherModule>("list.module.beans",
> PluginsConfigHelper.getModules()) {
> private static final long serialVersionUID = 1L;
> @Override
> protected void populateItem(ListItem<Module> item) {
> AjaxCheckBox box = new AjaxCheckBox("myCheckBox", Model.of(Boolean.TRUE) {
>
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void onUpdate(AjaxRequestTarget target)
> { target.add(ddc); }
>
> };
> box.setOutputMarkupId(true);
> box.setOutputMarkupPlaceholderTag(true);
> item.add(box);
> }
> };
>
> Thanks for your help.
>
> Alexandre
>