Re: ListView not updating when changed

2008-03-27 Thread Igor Vaynberg
i suppose you can try issuing a window.opener.wicket.ajax.get request
to trigger an ajax request, but i am not sure how and if
xmlhttprequest works across windows...

-igor


On Thu, Mar 27, 2008 at 7:56 AM, taygolf [EMAIL PROTECTED] wrote:

  I would have thought there was another way to do this. I can not refresh the
  whole page because I have other textfields and I will lose the data entered
  in them on a page refresh.

  I just want to refresh the markupcontainer that the ListView is in.

  I guess I need to look into change my popup class from a popup page to a
  div.

  Are there any other suggestions?



  Thanks

  T


  igor.vaynberg wrote:
  
   since its in a different page there isnt much you can do except
   something like outputting
   head
   script
   window.opener.refresh();
   window.close();
   /script
   /head
  
   after the form has been submitted
  
   -igor
  
  
   On Wed, Mar 26, 2008 at 6:39 PM, taygolf [EMAIL PROTECTED] wrote:
  
The popup is a different page. Just a simple page with 2 textfields and
   a few
check boxes and a submit button and I submit it via a regular post right
   now
but I can change that to ajax if that is what I need to do.
  
  
  
  
  
igor.vaynberg wrote:

 your popup is a different page or a div inside the current page? do
 you submit the form in it via ajax or a regular post?

 -igor


 On Wed, Mar 26, 2008 at 3:00 PM, taygolf [EMAIL PROTECTED]
   wrote:

  THanks for explaining it to me igor. I have been doing some
   searching
 about
  my other problem. Again my new problem is that I really do not want
   this
  listview to refresh on a timer. Here is the process of my app. The
   user
 can
  click on a link that says add member. that link inturn creates a
   popup
 page
  that has a form and some textfields. When the form is submitted I
   update
 the
  Session List to add that member and the popup is closed. Then when
   the
 timer
  tells the listview to refresh it gets the new informationfrom the
 session
  list the user just entered and updates the listview. Instead of
   having
 the
  listview refresh on a timer I would like for it to refresh when the
 popup
  window form is submited.

  How would I go about doing this? I have done some looking and I
   think
 maybe
  instead of using a listview I should be using a refreshingview. I
   made
 this
  change but it still does not solve my problem. Can I refresh the
   markup
  container from the popup? if so how? I was thinking maybe a
   AjaxSubmit
  button on the popup page but I am not sure. Anyway a little help
   with
 this
  would be awesome

  Thanks

  T






  igor.vaynberg wrote:
  
   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 =
   

Re: ListView not updating when changed

2008-03-27 Thread taygolf

 Can I change my popup window from a standard popup window to a modal window.
would that allow me to do what I am wanting to do.

All I want to do is have a main page. on that main page click a link. the
link will bring up a popup or a modal window, or a hidden div or what ever
that will allow me to enter information into a form. when the submit button
is clicked the popup will disappear and the information entered will be
displayed on the main page in a table form. After I get that working I want
to create a link that will allow me to edit that information and I also want
a button to delete that information.

I have all of this working with the way I am doing it currently but I do not
like the timer because it will refresh the parent page while i have the
popup window up.

Thanks

T

igor.vaynberg wrote:
 
 i suppose you can try issuing a window.opener.wicket.ajax.get request
 to trigger an ajax request, but i am not sure how and if
 xmlhttprequest works across windows...
 
 -igor
 
 
 On Thu, Mar 27, 2008 at 7:56 AM, taygolf [EMAIL PROTECTED] wrote:

  I would have thought there was another way to do this. I can not refresh
 the
  whole page because I have other textfields and I will lose the data
 entered
  in them on a page refresh.

  I just want to refresh the markupcontainer that the ListView is in.

  I guess I need to look into change my popup class from a popup page to a
  div.

  Are there any other suggestions?



  Thanks

  T


  igor.vaynberg wrote:
  
   since its in a different page there isnt much you can do except
   something like outputting
   head
   script
   window.opener.refresh();
   window.close();
   /script
   /head
  
   after the form has been submitted
  
   -igor
  
  
   On Wed, Mar 26, 2008 at 6:39 PM, taygolf [EMAIL PROTECTED]
 wrote:
  
The popup is a different page. Just a simple page with 2 textfields
 and
   a few
check boxes and a submit button and I submit it via a regular post
 right
   now
but I can change that to ajax if that is what I need to do.
  
  
  
  
  
igor.vaynberg wrote:

 your popup is a different page or a div inside the current page?
 do
 you submit the form in it via ajax or a regular post?

 -igor


 On Wed, Mar 26, 2008 at 3:00 PM, taygolf
 [EMAIL PROTECTED]
   wrote:

  THanks for explaining it to me igor. I have been doing some
   searching
 about
  my other problem. Again my new problem is that I really do not
 want
   this
  listview to refresh on a timer. Here is the process of my app.
 The
   user
 can
  click on a link that says add member. that link inturn creates a
   popup
 page
  that has a form and some textfields. When the form is submitted
 I
   update
 the
  Session List to add that member and the popup is closed. Then
 when
   the
 timer
  tells the listview to refresh it gets the new informationfrom
 the
 session
  list the user just entered and updates the listview. Instead of
   having
 the
  listview refresh on a timer I would like for it to refresh when
 the
 popup
  window form is submited.

  How would I go about doing this? I have done some looking and I
   think
 maybe
  instead of using a listview I should be using a refreshingview.
 I
   made
 this
  change but it still does not solve my problem. Can I refresh the
   markup
  container from the popup? if so how? I was thinking maybe a
   AjaxSubmit
  button on the popup page but I am not sure. Anyway a little help
   with
 this
  would be awesome

  Thanks

  T






  igor.vaynberg wrote:
  
   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
   

Re: ListView not updating when changed

2008-03-27 Thread Igor Vaynberg
yes, that way in modal window's close callback you have access to the
ajax request target

-igor


On Thu, Mar 27, 2008 at 1:39 PM, taygolf [EMAIL PROTECTED] wrote:

   Can I change my popup window from a standard popup window to a modal window.
  would that allow me to do what I am wanting to do.

  All I want to do is have a main page. on that main page click a link. the
  link will bring up a popup or a modal window, or a hidden div or what ever
  that will allow me to enter information into a form. when the submit button
  is clicked the popup will disappear and the information entered will be
  displayed on the main page in a table form. After I get that working I want
  to create a link that will allow me to edit that information and I also want
  a button to delete that information.

  I have all of this working with the way I am doing it currently but I do not
  like the timer because it will refresh the parent page while i have the
  popup window up.



  Thanks

  T

  igor.vaynberg wrote:
  
   i suppose you can try issuing a window.opener.wicket.ajax.get request
   to trigger an ajax request, but i am not sure how and if
   xmlhttprequest works across windows...
  
   -igor
  
  
   On Thu, Mar 27, 2008 at 7:56 AM, taygolf [EMAIL PROTECTED] wrote:
  
I would have thought there was another way to do this. I can not refresh
   the
whole page because I have other textfields and I will lose the data
   entered
in them on a page refresh.
  
I just want to refresh the markupcontainer that the ListView is in.
  
I guess I need to look into change my popup class from a popup page to a
div.
  
Are there any other suggestions?
  
  
  
Thanks
  
T
  
  
igor.vaynberg wrote:

 since its in a different page there isnt much you can do except
 something like outputting
 head
 script
 window.opener.refresh();
 window.close();
 /script
 /head

 after the form has been submitted

 -igor


 On Wed, Mar 26, 2008 at 6:39 PM, taygolf [EMAIL PROTECTED]
   wrote:

  The popup is a different page. Just a simple page with 2 textfields
   and
 a few
  check boxes and a submit button and I submit it via a regular post
   right
 now
  but I can change that to ajax if that is what I need to do.





  igor.vaynberg wrote:
  
   your popup is a different page or a div inside the current page?
   do
   you submit the form in it via ajax or a regular post?
  
   -igor
  
  
   On Wed, Mar 26, 2008 at 3:00 PM, taygolf
   [EMAIL PROTECTED]
 wrote:
  
THanks for explaining it to me igor. I have been doing some
 searching
   about
my other problem. Again my new problem is that I really do not
   want
 this
listview to refresh on a timer. Here is the process of my app.
   The
 user
   can
click on a link that says add member. that link inturn creates a
 popup
   page
that has a form and some textfields. When the form is submitted
   I
 update
   the
Session List to add that member and the popup is closed. Then
   when
 the
   timer
tells the listview to refresh it gets the new informationfrom
   the
   session
list the user just entered and updates the listview. Instead of
 having
   the
listview refresh on a timer I would like for it to refresh when
   the
   popup
window form is submited.
  
How would I go about doing this? I have done some looking and I
 think
   maybe
instead of using a listview I should be using a refreshingview.
   I
 made
   this
change but it still does not solve my problem. Can I refresh the
 markup
container from the popup? if so how? I was thinking maybe a
 AjaxSubmit
button on the popup page but I am not sure. Anyway a little help
 with
   this
would be awesome
  
Thanks
  
T
  
  
  
  
  
  
igor.vaynberg wrote:

 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
 

RE: ListView not updating when changed

2008-03-26 Thread taygolf

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);

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]



Re: ListView not updating when changed

2008-03-26 Thread Igor Vaynberg
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: 

Re: ListView not updating when changed

2008-03-26 Thread taygolf

THanks for explaining it to me igor. I have been doing some searching about
my other problem. Again my new problem is that I really do not want this
listview to refresh on a timer. Here is the process of my app. The user can
click on a link that says add member. that link inturn creates a popup page
that has a form and some textfields. When the form is submitted I update the
Session List to add that member and the popup is closed. Then when the timer
tells the listview to refresh it gets the new informationfrom the session
list the user just entered and updates the listview. Instead of having the
listview refresh on a timer I would like for it to refresh when the popup
window form is submited.

How would I go about doing this? I have done some looking and I think maybe
instead of using a listview I should be using a refreshingview. I made this
change but it still does not solve my problem. Can I refresh the markup
container from the popup? if so how? I was thinking maybe a AjaxSubmit
button on the popup page but I am not sure. Anyway a little help with this
would be awesome

Thanks

T




igor.vaynberg wrote:
 
 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
   

Re: ListView not updating when changed

2008-03-26 Thread Igor Vaynberg
your popup is a different page or a div inside the current page? do
you submit the form in it via ajax or a regular post?

-igor


On Wed, Mar 26, 2008 at 3:00 PM, taygolf [EMAIL PROTECTED] wrote:

  THanks for explaining it to me igor. I have been doing some searching about
  my other problem. Again my new problem is that I really do not want this
  listview to refresh on a timer. Here is the process of my app. The user can
  click on a link that says add member. that link inturn creates a popup page
  that has a form and some textfields. When the form is submitted I update the
  Session List to add that member and the popup is closed. Then when the timer
  tells the listview to refresh it gets the new informationfrom the session
  list the user just entered and updates the listview. Instead of having the
  listview refresh on a timer I would like for it to refresh when the popup
  window form is submited.

  How would I go about doing this? I have done some looking and I think maybe
  instead of using a listview I should be using a refreshingview. I made this
  change but it still does not solve my problem. Can I refresh the markup
  container from the popup? if so how? I was thinking maybe a AjaxSubmit
  button on the popup page but I am not sure. Anyway a little help with this
  would be awesome

  Thanks

  T






  igor.vaynberg wrote:
  
   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()));

Re: ListView not updating when changed

2008-03-26 Thread taygolf

The popup is a different page. Just a simple page with 2 textfields and a few
check boxes and a submit button and I submit it via a regular post right now
but I can change that to ajax if that is what I need to do.



igor.vaynberg wrote:
 
 your popup is a different page or a div inside the current page? do
 you submit the form in it via ajax or a regular post?
 
 -igor
 
 
 On Wed, Mar 26, 2008 at 3:00 PM, taygolf [EMAIL PROTECTED] wrote:

  THanks for explaining it to me igor. I have been doing some searching
 about
  my other problem. Again my new problem is that I really do not want this
  listview to refresh on a timer. Here is the process of my app. The user
 can
  click on a link that says add member. that link inturn creates a popup
 page
  that has a form and some textfields. When the form is submitted I update
 the
  Session List to add that member and the popup is closed. Then when the
 timer
  tells the listview to refresh it gets the new informationfrom the
 session
  list the user just entered and updates the listview. Instead of having
 the
  listview refresh on a timer I would like for it to refresh when the
 popup
  window form is submited.

  How would I go about doing this? I have done some looking and I think
 maybe
  instead of using a listview I should be using a refreshingview. I made
 this
  change but it still does not solve my problem. Can I refresh the markup
  container from the popup? if so how? I was thinking maybe a AjaxSubmit
  button on the popup page but I am not sure. Anyway a little help with
 this
  would be awesome

  Thanks

  T






  igor.vaynberg wrote:
  
   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 

Re: ListView not updating when changed

2008-03-26 Thread Igor Vaynberg
since its in a different page there isnt much you can do except
something like outputting
head
script
window.opener.refresh();
window.close();
/script
/head

after the form has been submitted

-igor


On Wed, Mar 26, 2008 at 6:39 PM, taygolf [EMAIL PROTECTED] wrote:

  The popup is a different page. Just a simple page with 2 textfields and a few
  check boxes and a submit button and I submit it via a regular post right now
  but I can change that to ajax if that is what I need to do.





  igor.vaynberg wrote:
  
   your popup is a different page or a div inside the current page? do
   you submit the form in it via ajax or a regular post?
  
   -igor
  
  
   On Wed, Mar 26, 2008 at 3:00 PM, taygolf [EMAIL PROTECTED] wrote:
  
THanks for explaining it to me igor. I have been doing some searching
   about
my other problem. Again my new problem is that I really do not want this
listview to refresh on a timer. Here is the process of my app. The user
   can
click on a link that says add member. that link inturn creates a popup
   page
that has a form and some textfields. When the form is submitted I update
   the
Session List to add that member and the popup is closed. Then when the
   timer
tells the listview to refresh it gets the new informationfrom the
   session
list the user just entered and updates the listview. Instead of having
   the
listview refresh on a timer I would like for it to refresh when the
   popup
window form is submited.
  
How would I go about doing this? I have done some looking and I think
   maybe
instead of using a listview I should be using a refreshingview. I made
   this
change but it still does not solve my problem. Can I refresh the markup
container from the popup? if so how? I was thinking maybe a AjaxSubmit
button on the popup page but I am not sure. Anyway a little help with
   this
would be awesome
  
Thanks
  
T
  
  
  
  
  
  
igor.vaynberg wrote:

 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 

Re: ListView not updating when changed

2008-03-25 Thread Johan Compagner
what happens if you set:
  lv.setReuseItems(true);

to false?

and what do you mean with go back and edit ? browser back?

johan


On Tue, Mar 25, 2008 at 3:02 PM, taygolf [EMAIL PROTECTED] wrote:


 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-tp16274984p16274984.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]




RE: ListView not updating when changed

2008-03-25 Thread Maeder Thomas
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]



Re: ListView not updating when changed

2008-03-25 Thread Igor Vaynberg
ListView lv = new PropertyListView(rows, kmList)
 {
   public void populateItem(final ListItem item)
   {
   item.add(new Label(kmname));
   item.add(new Label(kmsec));
   item.add(new Label(kmroles));
   }
 };

because you called setreuseitems(true) and hardcoded the values of
labels the updates will not show up because the component hierarchy is
not recreated due to setreuseitems(true). two options like others
said, turn off setreuseitems, or make your label display models
instead of hardcoded values, above is the easiest example...


-igor


On Tue, Mar 25, 2008 at 7:02 AM, taygolf [EMAIL PROTECTED] wrote:

  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-tp16274984p16274984.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]