You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by VGJ <za...@gmail.com> on 2009/05/01 20:05:40 UTC

Changing the attribute of a ListView tag?

I'm working with a 3rd. party Flash-based application which I'm trying to
integrate with our data.

To make a long story short, When the user clicks on a US state or foreign
country, I would like to un-hide a hidden <div> tag on the same page.  The
div tag is tied to a ListView - so basically, there are several hidden divs
which contain a data item (w/ a little JavaScript and the map unhides the
relevant one w/ a parameter.

So far, I'm having trouble figuring out how I can possibly do this.

Here's the tag:

<DIV wicket:id="customerList" id="#" style="DISPLAY: none">

Here's my ListItem and my attempt at re-assigning the ID value using a
WebMarkupContainer, so it ties to the values coming out of the map:

    add(new ListView("customerList", customerModel)
    {
      protected void populateItem(final ListItem item)
      {
        //current entity in loop
        final Customer customer = (Customer)item.getModelObject();

        //capture values needed for temp formatting variables
        String country = customer.getCountry() != null ?
customer.getCountry().trim() : "";
        String stateProv = customer.getStateProvince() != null ?
customer.getStateProvince().trim() : "";
        String city = customer.getCity() != null ? customer.getCity().trim()
: "";

        //category labels
        item.add(new Label("country", country));
        item.add(new Label("stateProv", stateProv));
        item.add(new Label("city", city));

        String tagId = null;

        if (!stateProv.equals(""))
          tagId = stateProv;
        else
          tagId = country;

        //modify check add-on img tag
        WebMarkupContainer container = new
WebMarkupContainer("customerList");
        container.add(new SimpleAttributeModifier("id", tagId));
        item.add(container);
      }
    });

It doesn't change the values and it doesn't throw me an error...the id value
remains "#"

What else can I do?

Thanks!

Re: Changing the attribute of a ListView tag?

Posted by Igor Vaynberg <ig...@gmail.com>.
are you trying to hide the entire listview or rows of the listview?

the current code will hide rows because the tag you attach the
listview to is repeated for each row.

if you want to hide the entire list you should put the listview into a
webmarkupcontainer and hide that instead.

if you want to hide each row...to set the id of the td tag above you
should call item.setmarketupid(whatever)

-igor

On Fri, May 1, 2009 at 11:05 AM, VGJ <za...@gmail.com> wrote:
> I'm working with a 3rd. party Flash-based application which I'm trying to
> integrate with our data.
>
> To make a long story short, When the user clicks on a US state or foreign
> country, I would like to un-hide a hidden <div> tag on the same page.  The
> div tag is tied to a ListView - so basically, there are several hidden divs
> which contain a data item (w/ a little JavaScript and the map unhides the
> relevant one w/ a parameter.
>
> So far, I'm having trouble figuring out how I can possibly do this.
>
> Here's the tag:
>
> <DIV wicket:id="customerList" id="#" style="DISPLAY: none">
>
> Here's my ListItem and my attempt at re-assigning the ID value using a
> WebMarkupContainer, so it ties to the values coming out of the map:
>
>    add(new ListView("customerList", customerModel)
>    {
>      protected void populateItem(final ListItem item)
>      {
>        //current entity in loop
>        final Customer customer = (Customer)item.getModelObject();
>
>        //capture values needed for temp formatting variables
>        String country = customer.getCountry() != null ?
> customer.getCountry().trim() : "";
>        String stateProv = customer.getStateProvince() != null ?
> customer.getStateProvince().trim() : "";
>        String city = customer.getCity() != null ? customer.getCity().trim()
> : "";
>
>        //category labels
>        item.add(new Label("country", country));
>        item.add(new Label("stateProv", stateProv));
>        item.add(new Label("city", city));
>
>        String tagId = null;
>
>        if (!stateProv.equals(""))
>          tagId = stateProv;
>        else
>          tagId = country;
>
>        //modify check add-on img tag
>        WebMarkupContainer container = new
> WebMarkupContainer("customerList");
>        container.add(new SimpleAttributeModifier("id", tagId));
>        item.add(container);
>      }
>    });
>
> It doesn't change the values and it doesn't throw me an error...the id value
> remains "#"
>
> What else can I do?
>
> Thanks!
>

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