If you want to manage the link styles separately, you'll need to use a
different variable in the backing bean for each one.  You'll probably
need to base it on the row index.   You could probably use an
actionListener to set the style for current row.

On 4/12/07, Brummeline Braaten <[EMAIL PROTECTED]> wrote:
I've got a datatable with a number of commandlinks. When I click on one of the
links, I would like the style for that actual link to change.

My code is like this:

<h:dataTable var="rader" value="#{tabnavigering.categoryList}"
id="kategorilisten">
 <h:column id="kategorikolonne">                                                   
       <t:commandLink
styleClass="#{tabnavigering.stil}" id="kategorilink"
action="#{tabnavigering.velgKategori}" >
   <h:outputText value="#{rader.categoryName}" id="kategorinavn"/>
   <f:param value="#{rader.categoryName}" name="kategorinavn"/>
   <f:param value="#{rader.categoryId}" name="kategoriid"/>
  </t:commandLink>                                                                       
</h:column>                                                                    
</h:dataTable>

In the bean I use this code to get the style:
public String getStil(){
                String stil="category";
                if(kategoriid!=null){
                        stil="category:active";
                }
                return stil;
        }

Now I get the right style when I open the page. When I click on the link, all
the links change to category:active.

How can I make it understand that it should just change the one I clicked?


Reply via email to