Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Accessing checkbox in af:foreeach

2706070Jul 3 2014 — edited Jul 3 2014


HI All,

     We have a requirement where lets say we have a employees table and I pass departmentId =30 and it filters the record in the UI. Lets say we have 3 records with employees names as ALEN, BLAKE, MARK.

So my requirement needs those 3 employees names shuld be appended to the employees table as 3 columns. This requirement we are able to do it through af:foreach(we passed the list of names from bean as items) in which we added columns with the names .

But we have to add a checkbox for each row columns . We added a checkbox inside the dynamic columns. So that we are able to add checkboxes. but the issue is how can be get the handle of this checkbox from the managed bean as we need to do had few validations for it .

eg: if the user selects one checkbox in ALEN column , he should not be able to check for anyother dynamic column , but he can select for the same column  different rows.

Please help us on this

Version : Jdev 11.1.2

code for UI :

=====================================================

<af:table value="#{bindings.EmployeesView1.collectionModel}" var="row"

                          rows="#{bindings.EmployeesView1.rangeSize}"

                          emptyText="#{bindings.EmployeesView1.viewable ? 'No data to display.' : 'Access Denied.'}"

                          fetchSize="#{bindings.EmployeesView1.rangeSize}" rowBandingInterval="0" id="t1">

                    <af:column sortProperty="#{bindings.EmployeesView1.hints.EmployeeId.name}" sortable="false"

                               headerText="#{bindings.EmployeesView1.hints.EmployeeId.label}" id="c1">

                        <af:outputText value="#{row.EmployeeId}"

                                       shortDesc="#{bindings.EmployeesView1.hints.EmployeeId.tooltip}" id="ot1">

                            <af:convertNumber groupingUsed="false"

                                              pattern="#{bindings.EmployeesView1.hints.EmployeeId.format}"/>

                        </af:outputText>

                    </af:column>

                    <af:column sortProperty="#{bindings.EmployeesView1.hints.FirstName.name}" sortable="false"

                               headerText="#{bindings.EmployeesView1.hints.FirstName.label}" id="c2">

                        <af:outputText value="#{row.FirstName}"

                                       shortDesc="#{bindings.EmployeesView1.hints.FirstName.tooltip}" id="ot2"/>

                    </af:column>

                  

                    <af:column sortProperty="#{bindings.EmployeesView1.hints.ManagerId.name}" sortable="false"

                               headerText="#{bindings.EmployeesView1.hints.ManagerId.label}" id="c5">

                        <af:outputText value="#{row.ManagerId}"

                                       shortDesc="#{bindings.EmployeesView1.hints.ManagerId.tooltip}" id="ot5">

                            <af:convertNumber groupingUsed="false"

                                              pattern="#{bindings.EmployeesView1.hints.ManagerId.format}"/>

                        </af:outputText>

                    </af:column>

                   

                     <af:forEach items="#{viewScope.forEachBean.tablelist}" var="def" varStatus="vs">

                        <af:column headerText="#{def}" sortable="true"

                                   id="c7" >

                                  

                         

                            <af:selectBooleanCheckbox  id="sbc1"

                                                      disabled="#{!fn:startsWith(def,row.FirstName)}"/>

                        </af:column>

                    </af:forEach>

                </af:table>

=======================================================================================

In the above checkbbox we are not able to get the handle of binding nor the values  . Please provide your comments.

Thank you,

Sashank P.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 31 2014
Added on Jul 3 2014
3 comments
187 views