Jdev版本11.1.1.7.1
我的用例场景如下: -
我有2个表作为“员工详细信息”,其中显示了不同员工的详细信息和“薪资明细”,其中显示了每个员工在不同月份的薪资明细。将根据第一个表中选择的行(即Employee)填充第二个表。第一个表有一个“Total Salary”列,最初为Blank,在点击名为“Estimate Salary”的按钮后,将根据第二个表的“Salary”列填充。
以下是我的代码: - 员工详细信息: -
<af:table value="#{bindings.EmployeeView.collectionModel}" var="row"
rows="#{bindings.EmployeeView.rangeSize}"
fetchSize="#{bindings.EmployeeView.rangeSize}"
rowBandingInterval="0"
selectedRowKeys="#{bindings..EmployeeView.collectionModel.selectedRow}"
selectionListener="#{bindings.EmployeeView.collectionModel.makeCurrent}"
rowSelection="single" id="resId1"
binding="#{backingBeanScope.backing_calculation.resId1}">
<af:column sortProperty="#{bindings.EmployeeView.hints.Name.name}"
sortable="true"
headerText="Employee Name"
id="resId1c1" width="230">
<af:outputText value="#{row.Name}" id="ot17"/>
</af:column>
<af:column sortProperty="#{bindings.EmployeeView.hints.Salary.name}"
sortable="true"
headerText="Total Salary"
id="resId1c5" noWrap="true" width="120">
<af:outputText value="#{row.Salary}" id="ot1" visible="false">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.EmployeeView.hints.SalesVol.format}"/>
</af:outputText>
</af:column>
</af:table>
Salary Details :-
<af:table value="#{bindings.SalaryView.collectionModel}"
var="row"
rows="#{bindings.SalaryView.rangeSize}"
fetchSize="#{bindings.SalaryView.rangeSize}"
rowBandingInterval="0"
selectedRowKeys="#{bindings.SalaryView.collectionModel.selectedRow}"
selectionListener="#{bindings.SalaryView.collectionModel.makeCurrent}"
rowSelection="single" id="resId2"
binding="#{backingBeanScope.backing_calculation.resId2}"
partialTriggers="::resId1">
<af:column sortProperty="#{bindings.SalaryView.hints.Month.name}"
sortable="true"
headerText="#{bindings.SalaryView.hints.Month.label}"
id="resId2c1">
<af:outputText value="#{row.Month}" id="ot26"/>
</af:column>
<af:column sortProperty="#{bindings.SalaryView.hints.Salary.name}"
sortable="true" headerText="Salary"
id="resId2c5" width="195">
<af:outputText value="#{row.Salary}" id="ot22">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.SalaryView.hints.Salary.format}"/>
</af:outputText>
</af:column>
</af:table>
Estimate Salary:-
<af:commandButton text="Estimate Salary"
binding="#{backingBeanScope.backing_calculation.cb3}"
id="cb3"/>
有人可以帮助我吗?
您可以编写托管bean方法来计算总薪水,并通过访问托管bean中的ViewObjectIterator来设置。
一些有用的adf代码
http://biemond.blogspot.in/2009/03/some-handy-code-for-backing-beans-adf.html
如果您的目的是在单击Estimate Salary按钮之前不填充Total Salary列,则可以在托管bean中按钮的动作侦听器中添加计算逻辑。查看从员工到工资的链接将确保当您在员工中选择一行时,会显示相应的工资记录,更像是父子关系。如果您不想要Estimate Salary按钮的额外负担,您可以在RowImpl类的Total Salary的setter方法中添加您的逻辑,它将为特定人员执行Salary记录的合并逻辑(查看链接有助于限制总和)在一个人的背景下)。