Hi,

On Feb 14, 2015 11:24 PM, "Chris" <[email protected]> wrote:
>
> Hi all,
>
> I would like to update a list model when the user clicks on a certain
link. However, when the listPanel is rendered after clicking on the link,
the model seems not to be updated and still contains the old values.
>
> How to fix this?
>
> PAGE:
>
> IModel<List<P>> pModel;
>
> public SomePage() {
>
>         pModel = new ListModel<P>(someService.caculate());
>
>         final Panel listPanel = new ListPanel("itemList", pModel);
>         add(listPanel);
>
>     add(new AjaxFallbackLink("link") {
>             @Override
>             public void onClick(AjaxRequestTarget target) {
>                 pModel = new ListModel<P>(someService.caculate());

^^^ Here you loose the connection to listPanel.

Instead do :
pModel.clear()
pModel.addAll(...)

>                 target.add(listPanel);
>             }
>     });
> }
>
> Thanks!
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

Reply via email to