On Wed, Mar 26, 2008 at 6:57 AM, taygolf <[EMAIL PROTECTED]> wrote: > > that worked prefect Thanks for the help. I decided to go with the Model > example. I do have a few more questions though. First why cant I use a > PropertyModel instead of a AbstractReadOnlyModel. I tried to do this: > > New Label("kmname", new PropertyModel(kmd, "name");
because you are still caching the instance of kmd in the model by passing it directly, instead new PropertyModel(item.getModel(), "name"); that way the models are chained properly -igor > > but that did not work. I am guessing that getObject has to be called or the > ListView will not get updated but that is just my guess. > > Also right now I am using AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)) > to get the ListView to updated but I would like to do this from my popup > instead. So there is a link that will create a popup and that popup adds > info to the session variable that the ListView uses. When the submit button > is clicked on that popup I would like to refresh the ListView instead of > waiting for the 5 seconds to go by. I have done some looking and I think I > need to us an AjaxFullBackLink but I wnated to go ahead and ask to make sure > I was looking in the right direction > > Thanks > > T > > > > Thomas Maeder wrote: > > > > 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: users@wicket.apache.org > >> 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] > > > > > > > > -- > View this message in context: > http://www.nabble.com/ListView-not-updating-when-changed-tp16274984p16301167.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]