You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Scott Swank <sc...@gmail.com> on 2011/03/01 02:01:32 UTC

ajax refresh of ListItems

I have an html table with a ListView generating the rows.  Certain
rows in the middle of the table are initially hidden via
setVisible(false), but then displayed later when an AjaxLink is
clicked.  In order to effect this I have had tenclose the table in a
div with wicket:id="tableContainer", and then choose the component to
update in an odd manner.

onClick(AjaxRequestTarget target) {
  // for each relevant ListItem
  item.setVisible(toggleValue);

  // why?????
  if (item.isVisible())
    target.addComponent(item);
  else
    target.addComponent(tableContainer);
}

The rows will only be made visible if the specific ListItems are added
to the AjaxRequestTarget.  Refreshing the entire tableContainer does
not display them, even though they have setVisible(true).  Conversely,
to hide them I have to refresh tableContainer, refreshing each
ListItem does not hide them.

While I have this working, after a fair bit of trial & error, I am
unsure why my earlier approaches failed: 1. always refreshing the
ListItem will not hide them, 2. always refreshing the tableContainer
will not display them.

Is this related to a bug, or am I missing something about ListViews & ajax?

Thank you,
Scott

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


Re: ajax refresh of ListItems

Posted by Igor Vaynberg <ig...@gmail.com>.
does the listitem have setoutputmarkupplaceholdertag(true)?

-igor

On Mon, Feb 28, 2011 at 5:01 PM, Scott Swank <sc...@gmail.com> wrote:
> I have an html table with a ListView generating the rows.  Certain
> rows in the middle of the table are initially hidden via
> setVisible(false), but then displayed later when an AjaxLink is
> clicked.  In order to effect this I have had tenclose the table in a
> div with wicket:id="tableContainer", and then choose the component to
> update in an odd manner.
>
> onClick(AjaxRequestTarget target) {
>  // for each relevant ListItem
>  item.setVisible(toggleValue);
>
>  // why?????
>  if (item.isVisible())
>    target.addComponent(item);
>  else
>    target.addComponent(tableContainer);
> }
>
> The rows will only be made visible if the specific ListItems are added
> to the AjaxRequestTarget.  Refreshing the entire tableContainer does
> not display them, even though they have setVisible(true).  Conversely,
> to hide them I have to refresh tableContainer, refreshing each
> ListItem does not hide them.
>
> While I have this working, after a fair bit of trial & error, I am
> unsure why my earlier approaches failed: 1. always refreshing the
> ListItem will not hide them, 2. always refreshing the tableContainer
> will not display them.
>
> Is this related to a bug, or am I missing something about ListViews & ajax?
>
> Thank you,
> Scott
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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