If memory serves, the ListView will not repopulate already existing items. I
see two options:
1) setReuseItems(false)
2) instead of creating the label with a fixed String (I assume that
kmd.getName() returns a String) pass an IModel to the label like so:
New Label("kmname", new AbstractReadOnlyModel() {
public Object getObject() {
KeyMemberData kmd = (KeyMemberData)item.getModelObject();
return kmd.getName();
}
});
Hth
Thomas
> -----Original Message-----
> From: taygolf [mailto:[EMAIL PROTECTED]
> Sent: Dienstag, 25. März 2008 15:03
> To: [email protected]
> Subject: ListView not updating when changed
>
>
> ok here is what I have. i have a listview that I want to
> update on the fly.
> The user clicks a link and that link opens a popup. in that
> popup the user will put in the information required and hit
> submit. once the information is submitted I am saving it in a
> session list of models. So the model that was created on the
> popup page is added to the list.
>
> THe listview is created using the session list as a
> loadabledetachablemodel.
> Everytime a new entry is entered everything works fine but if
> I want to go back and edit a previous entry then the listview
> never shows that update.
>
> So how can I get the listview to see the update. I am
> thinking that the loadabledetachable model is not getting the
> latest and greatest session list. I think it may only be
> looking for additions and not getting all of them. HOw do I fix that.
>
> Here is my code
>
> IModel kmList = new LoadableDetachableModel()
> {
> protected Object load() {
> return MySession.get().getKeymemberList();
> }
> };
>
> ListView lv = new ListView("rows", kmList)
> {
> public void populateItem(final ListItem item)
> {
> KeyMemberData kmd =
> (KeyMemberData)item.getModelObject();
> item.add(new Label("kmname", kmd.getName()));
> item.add(new Label("kmsec", kmd.getSecurity()));
> item.add(new Label("kmroles", kmd.getRoles()));
> }
> };
> lv.setReuseItems(true);
> lv.setOutputMarkupId(true);
> WebMarkupContainer listContainer = new
> WebMarkupContainer("theContainer");
> listContainer.setOutputMarkupId(true);
> listContainer.add(new
> AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
>
> listContainer.add(lv);
> add(listContainer);
> --
> View this message in context:
> http://www.nabble.com/ListView-not-updating-when-changed-tp162
> 74984p16274984.html
> 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]