1 Reply Latest reply on Sep 2, 2007 10:36 AM by Pete Muir

    @DataModelSelectionIndex always returns 0

    Troy Tarrrant Newbie

      Hi,

      I have the following class:

      @Scope(ScopeType.APPLICATION)
      public class EXAccessPoint {
      ...
       @DataModel
       private List<EntryExit> currentAlerts;
       @DataModelSelectionIndex
       private int alertIndex;
      ...
       public void actionAlert() {
       log.info("actionAlert():alertIndex=" + alertIndex);
       alerts.remove(alertIndex);
       calculateAlerts();
       }
      
      


      and no matter what element I click in the rendered grid, the alertIndex is always 0 so it always removes the first item? What am I doing wrong?

      Here is is rendered (portion) of the page

      <h:dataTable value="#{entryGate.currentAlerts}" var="alert">
       <h:column>
       <f:facet name="header">Alert</f:facet>
       <h:commandLink action="#{entryGate.actionAlert}">#{alert.message}"</h:commandLink>
       </h:column>
      </h:dataTable>
      


      Thanks

      Troy