0 Replies Latest reply on Jun 5, 2008 5:42 AM by benjes

    Strange behaviour with id attribute in aj4:coomandLink in ri

    benjes

      Hi,

      I've got a table containing one column of aj4:commandLinks.
      I am trying to use spatial key navigation using CSS3 styles between the links so I need to know the ids for the style attribute
      I basically want something like


      <a href="#" id="Link1" style="nav-index:1;nav-down:Link2">Link 1</a>
      <a href="#" id="Link2" style="nav-index:2;nav-up:Link1;nav-down:Link3">Link 2</a>


      To do that I need to set an individual id for every link and I need to know in advance what ids my neighbours have. But when I try to do that I get an odd behaviour. (With Seam 2.0.2GA and RichFaces 3.2.0.SR1)

      The example is like this:
      <a4j:form id="FormID">
       <rich:dataTable id="TableID" var="stationEntry"
       value="#{StationListManager.entryList}"
       rendered="#{not empty StationListManager.entryList}">
       <rich:column id="ColID">
       <a4j:commandLink value="#{stationEntry.station.name}"
       id="#{StationListManager.getStationId(stationEntry)}"
       style="#{stationEntry.navString}"
       action="#{stationsHome.selectStation(stationEntry.station)}"
       reRender="NowNext">
       </a4j:commandLink>
       </rich:column>
       </rich:dataTable>
      </a4j:form>


      The odd thing is that the function for the id attribute in commandLink
      id="#{StationListManager.getStationId(stationEntry)}"
      is called before the function for the value attribute in the dataTable
      value="#{StationListManager.entryList}"
      and stationEntry is null at that time.
      And the id function
      id="#{StationListManager.getStationId(stationEntry)}"
      is only called once! I expected it to be called for every link.
      Can't I set the id for every link? It seems RichFaces will just take the ids of the parents and ad its own numbering to it.
      Is that the correct behaviour? How can I predict what ids I will get?

      Thanks for your help

      Immo