Search code examples
oracle-adfjdeveloper

How to set value of dynamic textInputs of dynamic created table in ADF?


I created dynamic table and also created dynamic textInputs:

XML Below:

    <af:forEach items="#{myRowController.myList}" var = "myItem">

        <af:column  headerText="#{myItem}" width="104" attributeChangeListener="#{test.column_attributeChangeListener}">
                  <af:inputText value="" id="tt01"/>
        </af:column>

    </af:forEach>

 </af:table>

Problem is:

Created inputTexts have same id and I entered value doesn't set table inputText's

I want to enter values into table and submit all values into table.


Solution

  • <af:table value="#{viewScope.ScheduleActivityBean.rows}"
    autoHeightRows="0" varStatus="rwst" var="row" rendered="true"
    id="t1" width="100%">
    <af:forEach items="#{viewScope.ScheduleActivityBean.columnNames}"
    varStatus="colIndex" var="name">
    <af:column align="left" headerText="#{name}" width="250px" id="col1"
    rendered="#{colIndex.index eq 0}">
    <af:inputText id="i7" readOnly="true"
    contentStyle="width:170px;font-weight:bold;color:rgb(49,49,49);"
    value="#{row.activity}"/>
    <af:column align="center" headerText="#{name}" width="120px"
    id="co1_${rwst.index}" >
    <af:inputText id="it27" readOnly="true"                       
    value="#{row.scheduleName}"
    />
    

    Table data is fetched from viewScope.ScheduleActivityBean.rows Column names are retrieved from viewScope.ScheduleActivityBean.columnNames input text values has references as row.scheduleName and row.activity where is row is an element or object of ScheduleActivityBean.rows arraylist(table data).

    You can write similar logic for your requirement .