instead of pushing the right values when things change you should make
everything pull, that way updates happen on the fly... see the ajax
dropdown example in wicket examples.

-igor


On 10/5/07, Larva <[EMAIL PROTECTED]> wrote:
>
> Thanks Igor for your quick answer.
> I call the page.render() method because in the submit I set properties in
> the page that use to filter my custom dataview.
> Then, if a don't invoke the page render the dataview isn't update.
> I tried invoking only the render method of my dataview but I got the same
> issue.
>
> This is my code:
>
> DropDownChoice A
>
>         private DropDownChoice getTipoDelegacionDDC(final FiltroEmbarqueForm 
> form)
> {
>         DropDownChoice ddcTipoDel = new DropDownChoice("tipoDelegacion", new
> PropertyModel(this, "tipoDelegacion"),
> Arrays.asList(TipoDelegacion.values()));
>         ddcTipoDel.add(new AjaxFormComponentUpdatingBehavior("onchange") {
>             protected void onUpdate(AjaxRequestTarget target) {
>                 getDelegaciones().clear();
>                 DropDownChoice delegDDC = form.delegacionDDC;
>
> delegDDC.setChoices(getDelegacionesPorTipo(getTipoDelegacion()));
>                 target.addComponent(delegDDC);
>             }
>         });
>         return ddcTipoDel;
>     }
>
> DropDownChoice B
>
>         private DropDownChoice getDelegacionDDC(FiltroEmbarqueForm form) {
>
>                 List list = Collections.EMPTY_LIST;
>         String tipoDelagacion = form.tipoDelegacion;
>         if (tipoDelagacion != null) {
>             list = getDelegacionesPorTipo(getTipoDelegacion());
>         }
>         DropDownChoice delegacionDDC = new DropDownChoice("delegacion", new
> PropertyModel(this, "delegacion"), list);
>         delegacionDDC.setOutputMarkupId(true);  // Needed for Ajax to update
> it
>         delegacionDDC.setNullValid(true);
>         return delegacionDDC;
>         }
>
> Redefined onSubmit method
>         public final void onSubmit()
>         {
>                 SiconaraBasePage page = (SiconaraBasePage)getPage();
>                 List pageFilters = page.getFilterProperties();
>
>                 if (pageFilters != null)
>                         pageFilters.clear();
>
>                 ParFiltro f1 = new ParFiltro("afiliado.delegacion.tipo",
> getTipoDelegacion());
>                 ParFiltro f2 = new ParFiltro("afiliado.delegacion.alias",
> getDelegacion());
>                 if (f1.getValue() != null && !f1.getValue().equals(""))
>                         pageFilters.add(f1);
>                 if (f2.getValue() != null && !f2.getValue().equals(""))
>                         pageFilters.add(f2);
>                 page.render();
>         }
>
> The ParFiltro class is a utility class wich contains a pair property-value
> used in the page to filter data.
> That's because I need to invoke the page.render() method.
> I'm doing something wrong? There is another way to do it?
>
> Thanks in advance.
> Pablo.
>
>
>
>
> igor.vaynberg wrote:
> >
> > you shouldnt call page.render()
> >
> >
> > -igor
> >
> >
> > On 10/5/07, Larva <[EMAIL PROTECTED]> wrote:
> >>
> >> Hi !! I have this hierarchy:
> >> Panel
> >>    Form
> >>      DropDownChoice (A and B)
> >>
> >> I have these two DropDownChoices (A and B) and I am
> >> refreshing the choices in B through Ajax when the
> >> selection in A changes. I use this dorpdownchoices to
> >> define a filter for my dataview.
> >> That works fine, when I submit the form the selected
> >> properties in each dropdown are used to filter the
> >> rows of the dataview. I refresh the page with the
> >> method page.render()
> >> The problem is that after sumbit and render the page
> >> the dropdownchoices doesn't work anymore. In fact, the
> >> link to the Ajax debug console disappeared and if I
> >> view the source of the html, there is no reference to
> >> the wicket-event.js and wicket-ajax.js
> >> Any help?
> >> Thanks in advance
> >> Pablo.
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Ajax-dropdownchoice-doesn%27t-work-after-submit-tf4574920.html#a13058549
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Ajax-dropdownchoice-doesn%27t-work-after-submit-tf4574920.html#a13064454
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to