make a quickstart and i will take a look

-igor


On Wed, Feb 27, 2008 at 2:16 AM, Martin Makundi
<[EMAIL PROTECTED]> wrote:
> It is in quotes, sorry. Still, the list is updated only if it is not
>  empty on the first use.
>
>  **
>  Martin
>
>
>
>  2008/2/27, Igor Vaynberg <[EMAIL PROTECTED]>:
>  > ListView l = new ListVIew(.., new PropertyModel(this, listViewElements));
>  >
>  >
>  > listViewElements should be in quotes as per my earlier suggestion...
>  >
>  >  -igor
>  >
>  >
>  >  On Tue, Feb 26, 2008 at 10:19 PM, Martin Makundi
>  >
>  > <[EMAIL PROTECTED]> wrote:
>  >  > Funny. This works only if:
>  >  >  a) the listView is embedded in a Form component. (I would think it can
>  >  >  be independent)
>  >  >  b) the listView is not empty to begin with. If it is empty to begin
>  >  >  with, the new elements will not appear. If it is populated with 1 item
>  >  >  in the beginning, adding items will work fine.
>  >  >
>  >  >  So.. am I still doing something wrong?
>  >  >
>  >  >
>  >  >  Code is trivial:
>  >  >
>  >  >  public class MyPage extends WebPage {
>  >  >
>  >  >   public MyPage() {
>  >  >       Form f = new MyForm();
>  >  >     listViewElements =  new LinkedList();
>  >  >    listViewElements.add(new CustomElement()); // If I add a dummy
>  >  >  initial element, the added elements work fine. Otherwise not
>  >  >      ListView l = new ListVIew(.., new PropertyModel(this, 
> listViewElements));
>  >  >     f.add(l); // Otherwise it does not work at all without setting the
>  >  >  form as its parent; strange
>  >  >
>  >  >   }
>  >  >
>  >  >   class MyForm() {
>  >  >     onSubmit() {
>  >  >       listViewElements.add(new CustomElement());
>  >  >       info("Successful.");
>  >  >     }
>  >  >   }
>  >  >  }
>  >  >
>  >  >  2008/2/27, Igor Vaynberg <[EMAIL PROTECTED]>:
>  >  >
>  >  >
>  >  > > try
>  >  >  >
>  >  >  >  ListView l = new ListVIew(.., new propertymodel(this, 
> "listViewElements"));
>  >  >  >
>  >  >  >  -igor
>  >  >  >
>  >  >  >
>  >  >  >  On Tue, Feb 26, 2008 at 9:41 PM, Martin Makundi
>  >  >  >
>  >  >  > <[EMAIL PROTECTED]> wrote:
>  >  >  >  > > your listview model is probably caching the old list, and
>  >  >  >  >  >  thus when it redraws you dont see the new items. paste your 
> code and
>  >  >  >  >  >  we can help you more.
>  >  >  >  >
>  >  >  >  >  This is exactly what is happening. The listView is populated at 
> the
>  >  >  >  >  Page constructor. If the page is reloaded after onSubmit, the
>  >  >  >  >  constructor is not called again because the page is already
>  >  >  >  >  instantiated. Code is trivial:
>  >  >  >  >
>  >  >  >  >  public class MyPage extends WebPage {
>  >  >  >  >
>  >  >  >  >    public MyPage() {
>  >  >  >  >        Form f = new MyForm();
>  >  >  >  >      listViewElements =  new LinkedList();
>  >  >  >  >       ListView l = new ListVIew(.., listViewElements);
>  >  >  >  >    }
>  >  >  >  >
>  >  >  >  >    class MyForm() {
>  >  >  >  >      onSubmit() {
>  >  >  >  >        listViewElements.add(new CustomElement());
>  >  >  >  >        info("Successful.");
>  >  >  >  >        // here I would like to acknowledge that the listView
>  >  >  >  >        // should be repainted to include the new element; 
> otherwise
>  >  >  >  >  the old listView is shown
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >      }
>  >  >  >  >    }
>  >  >  >  >  }
>  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >  -igor
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >  On Tue, Feb 26, 2008 at 8:50 PM, Martin Makundi
>  >  >  >  >  >  <[EMAIL PROTECTED]> wrote:
>  >  >  >  >  >  > Hi!
>  >  >  >  >  >  >
>  >  >  >  >  >  >  Is it possible to refresh a listView during a form 
> onSubmit event,
>  >  >  >  >  >  >  without using ajax? Is there any way (apart from ajax) to 
> do it than
>  >  >  >  >  >  >  by explicitly reloading the page?
>  >  >  >  >  >  >
>  >  >  >  >  >  >  If I reload the page I must store the feedback messages 
> elsewhere
>  >  >  >  >  >  >  (session-scope feedback messages) and re-initialize all 
> the components
>  >  >  >  >  >  >  "manually". Or is there maybe something like 
> listView.repaint() or
>  >  >  >  >  >  >  page.refresh() which can be called from Form.onSubmit()?
>  >  >  >  >  >  >
>  >  >  >  >  >  >  This is what I have:
>  >  >  >  >  >  >
>  >  >  >  >  >  >  <feedback messages here/>
>  >  >  >  >  >  >  Item: [                          ] (textfield)  ["Add" 
> Submit-button]
>  >  >  >  >  >  >
>  >  >  >  >  >  >  <table>
>  >  >  >  >  >  >   <tr>previously added item</tr>
>  >  >  >  >  >  >   <tr>previously added item</tr>
>  >  >  >  >  >  >   <tr>previously added item</tr>
>  >  >  >  >  >  >  </table>
>  >  >  >  >  >  >
>  >  >  >  >  >  >  This is what I want:
>  >  >  >  >  >  >
>  >  >  >  >  >  >  When the "Add" -button is pressed, the form.onSubmit() is 
> called and a
>  >  >  >  >  >  >  new element is added into the list of elements (used as 
> the source for
>  >  >  >  >  >  >  the listView pupulating the table). I would then like to 
> "reload" the
>  >  >  >  >  >  >  page and show a success message in the feedback panel.
>  >  >  >  >  >  >
>  >  >  >  >  >  >  I know this can be maneuvered by actually reloading the 
> page and using
>  >  >  >  >  >  >  session-scope feedback messages, but is there some "soft 
> reload",
>  >  >  >  >  >  >  which sort-of shortcuts using session-scope feedback 
> messages?
>  >  >  >  >  >  >
>  >  >  >  >  >  >  Technically the difference is small, but conceptually I 
> find "soft
>  >  >  >  >  >  >  refresh" more intuitive.
>  >  >  >  >  >  >
>  >  >  >  >  >  >  **
>  >  >  >  >  >  >  Martin
>  >  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  > >  
> ---------------------------------------------------------------------
>  >  >  >  >  >  >  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]
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >
>  >  >  >  >  
> ---------------------------------------------------------------------
>  >  >  >  >  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]
>  >  >  >
>  >  >  >
>  >  >
>  >  >  ---------------------------------------------------------------------
>  >  >  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]
>  >
>  >
>
>  ---------------------------------------------------------------------
>  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