0 Replies Latest reply on May 31, 2011 8:05 AM by Patrick Huber

    dynamic datatable with dynamic input fields

    Patrick Huber Newbie

      Hi everyone, I'm using richfaces 4, but my Problem is not a richfaces-thing. But maybe someone here can still help me out of this.

      What I want to achieve is a datatable which is rendered depending on the users action. I can to this with this code :

       

       

      <rich:inplaceSelect value="#{templateBean.template.name}" valueChangeListener="#{templateBean.tempChange}" defaultLabel="possible options">

       

      <f:selectItems value="#{templateBean.templateList}" var="template" itemLabel="#{template.name}" itemValue="#{template.templateID}"/>

      <a4j:ajax event="change" render="output_1" />

       

      </rich:inplaceSelect>

       

       

      <a4j:outputPanel id="output_1" layout="block">

          

      <rich:extendedDataTable value="#{contentBean.contentList}" var="content" styleClass="table">

      <c:forEach items="#{fieldBean.findFieldByTemplate(templateBean.template.templateID)}" var="field">

       

      <rich:column>

       

      <f:facet name="header">

      <h:outputText value="#{field.name}"/>

                                                                  </f:facet>

       

      <h:inputText value="#{content.entry}" style="width:50px"/>   // how can someone puts value in here for each column with only one variable

      </rich:column>

       

      </c:forEach>

      <rich:column>

      <h:commandButton value="add" action="#{contentBean.add(templateBean.template.templateID)}" />

      </rich:column>

      </rich:extendedDataTable>

       

          

      </a4j:outputPanel>

       

       

      This works nice but the Problem is, I also want to give the User the possibility to add content to each column. I guess this is not possible isn't it ? Because I can not add dynamically variables, right ? Can anyone help me ? Tips, Hints are very appreciated