1 Reply Latest reply on Jul 11, 2008 1:00 PM by gibiman

    Is there any way to get the index of an HtmlColumn in a Html

    gibiman

      Hi ,



      I have a reference to the binding attribute of the HtmlColumn , by invoking event.getComponent().getParent() on a ValueChangeEvent object.


      What i cannot do is get the actual index of the column which launched the valueChangeEvent . I wouldn't want to get the column using the Id .



      This is my code :


      <rich:column>
       <f:facet name="header">
       <h:outputText value="Nume Atribut 1" />
       </f:facet>
       <rich:inplaceInput layout="block"
       value="#{tipProdus.atributAditional1}" id="inplace1"
       changedHoverClass="hover" viewHoverClass="hover"
       viewClass="inplace" changedClass="inplace" selectOnEdit="true"
       editEvent="ondblclick">
      
       <a4j:support event="onviewactivated" reRender="table" />
      
       </rich:inplaceInput>
       <h:selectOneMenu styleClass="selectTipAtribut"
      
       value="#{tipProdus.tipAtributAditional1 }"
       valueChangeListener="#{gestionareTipProdusPageBean.selectieTipAtribut}">
       <f:selectItems
       value="#{gestionareTipProdusPageBean.tipuriAtribute }" />
       <a4j:support
       reRender="editareListaPanel" event="onchange">
       <f:param name="rowNo" value="#{row}" />
       <f:param name="xx" value="xxx" />
       </a4j:support>
      
      
       </h:selectOneMenu>
       <h:outputText value="#{tipProdus.atributAditional1}" />
       </rich:column>
      


      Any thoughts or opinions are more than welcomed .

      Victor

        • 1. Re: Is there any way to get the index of an HtmlColumn in a
          gibiman

          Found a rather not-fancy way :


          HtmlColumn column = (HtmlColumn) event.getComponent().getParent();
          HtmlDataTable ht = new HtmlDataTable();
           Iterator<UIComponent> columnsIterator = ht.columns();
           int i = -1;
           while ( columnsIterator.hasNext() ){
           i++;
           if ( columnsIterator.next() == column ){
           logger.debug("Found column at index :"+i);
           break;
           }
           }
          


          Thanks,
          Victor