it is called that way for security reasons, eg so you cannot click a
link that is not visible just because you know its url...

what he should do is follow the delete call with a listview.detach() call

-igor



On Thu, Mar 6, 2008 at 10:56 AM, Edvin Syse <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I've run a cross a small dilemma while teaching one of my employees Wicket. 
> On his first project he created a ListView that pulls data from
>  a LoadableDetachableModel. He overrides isVisible on the ListView, and does:
>
>  @Override public boolean isVisible() {
>         return ((List)myModel.getObject()).size() > 0;
>  }
>
>  .. so the list won't be visible if the list is empty.
>
>  In the ListView ha has a button that deletes items. The code was originally:
>
>  item.add(new Link("delete") {
>         @Override public void onClick() {
>                 myDao.delete(item.getModelObject());
>         }
>  });
>
>  When he clicks the delete-link, isVisible() for the ListView is called 
> BEFORE the onClick() action, and since it is a
>  LoadableDetachableModel, it then holds the data from the list as it was 
> before the row is deleted. The result is ofcourse that the deleted
>  object is still in the list when the page rerenders, which forces him to 
> include a setResponsePage(TheListPage.class) instead of just
>  letting the ListView reuse items and render itself again.
>
>  It's a bit of a surprice that isVisible() is called before the onClick() 
> method. I understand that this has to do with the flow of things in
>  Wicket, but if someone can shed some light as to why/how, I'd ble glad to 
> contribute a Wicket page explaining this dilemma and how to get
>  around it, as I'm sure people run into this problem regularily.
>
>  -- Edvin
>
>
>
>
>  ---------------------------------------------------------------------
>  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