FeedbackPanel for each ListItem in ListView

2010-10-15 Thread Patrick Petermair

Hey!

I have ListView and every ListItem has multiple AjaxEditableLabels and 
one FeedbackPanel added to it. Each FeedbackPanel should only show 
messages that were reported within the same listitem.


I tried the following but it didn't work:

protected void populateItem(final ListItem item) {

[...]
item.add(new FeedbackPanel("someId", new
ContainerFeedbackMessageFilter(item)));
}

Somehow when the AjaxEditablelabel submits, the list items get created 
from scratch, which screws up object references and therefore 
container.contains(message.getReporter(), true) of the 
ContainerFeedbackMessageFilter never returns true.


Am I doing something wrong here? What would be the proper way to check 
if a feedback message was created within a listitem?


Cheers,
Patrick

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: FeedbackPanel for each ListItem in ListView

2010-10-15 Thread jcgarciam

Hi, try:

yourListView.setReuseItems(true);

>From the JavaDoc:
*WARNING:* though you can nest ListViews within Forms, you HAVE to set the
setReuseItems property to true in order to have validation work properly. By
default, setReuseItems is false, which has the effect that ListView replaces
all child components by new instances. The idea behind this is that you
always render the fresh data, and as people usually use ListViews for
displaying read-only lists (at least, that's what we think), this is good
default behavior.
However, as the components are replaced before the rendering starts, the
search for specific messages for these components fails as they are replaced
with other instances. Another problem is that 'wrong' user input is kept as
(temporary) instance data of the components. As these components are
replaced by new ones, your user will never see the wrong data when
setReuseItems is false.

*
*
On Fri, Oct 15, 2010 at 9:58 AM, Patrick Petermair [via Apache Wicket] <
ml-node+2996972-1727673597-65...@n4.nabble.com
> wrote:

> Hey!
>
> I have ListView and every ListItem has multiple AjaxEditableLabels and
> one FeedbackPanel added to it. Each FeedbackPanel should only show
> messages that were reported within the same listitem.
>
> I tried the following but it didn't work:
>
> protected void populateItem(final ListItem item) {
>
>  [...]
>  item.add(new FeedbackPanel("someId", new
>  ContainerFeedbackMessageFilter(item)));
> }
>
> Somehow when the AjaxEditablelabel submits, the list items get created
> from scratch, which screws up object references and therefore
> container.contains(message.getReporter(), true) of the
> ContainerFeedbackMessageFilter never returns true.
>
> Am I doing something wrong here? What would be the proper way to check
> if a feedback message was created within a listitem?
>
> Cheers,
> Patrick
>
> -
> To unsubscribe, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=2996972&i=0>
> For additional commands, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=2996972&i=1>
>
>
>
> --
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/FeedbackPanel-for-each-ListItem-in-ListView-tp2996972p2996972.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65...@n4.nabble.com
> To unsubscribe from Apache Wicket, click 
> here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>


-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/FeedbackPanel-for-each-ListItem-in-ListView-tp2996972p2996985.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org