How to calculate ADF table column
来源:互联网 发布:js数组转为json字符串 编辑:程序博客网 时间:2024/06/09 16:56
很多时候,我们需要统计表格的某一列的总和,然而ADF table并没有直接提供这种功能,这需要我们自己写代码来实现。效果如下图:
二、实现
- BC层实现
假设当前表格基于的VO名为SearchRebateVO,里面有入库数量、出库数量、销售金额、现有数量列需要求和,现在只以销售金额(对应VO中的字段为AdjSaleAmount)为例,在VO中新建一个名为(TotalAdjSaleAmount)的字段,为oracle.jbo.domain.Number(与AdjSaleAmount类型一致)。如图所示:
然后生成VO对应的VOImpl和VORowImpl类(SearchRebateVOImpl和SearchRebateVORowImpl),在VOImpl添加一个方法为如下
为了便于代码的重用,对如何汇总做了封装,这里继承了ViewObjectImpl里面对getTotal(StringattributeName)做了实现
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import oracle.jbo.domain.Number;
import oracle.jbo.server.ViewObjectImpl;
public class CustomViewObjectImpl extends ViewObjectImpl {
}
将VOImpl类由原来继承ViewObjectImpl,改为继承类CustomViewObjectImpl。接下来,在VORowImpl类中做适当的修改
现在只需要在页面进行些处理就OK了
- UI层实现
在页面定义文件中添加AttributeBinding,如下图步骤
在页面table的column footer中通过EL表达式引用TotalAdjSaleAmount
注:如果需要给outputText组件添加convertNumber,outputText的value中不能出现非数字字符,另外还需写成#{bindings.TotalAdjSaleAmount.inputValue},因为#{bindings.TotalAdjSaleAmount}是非数字类型的对象。
并且给该文本输出框添加partialTriggers和rendered(添加rendered,如果表格没有显示行的时候,将不会显示tablefooter)
<f:facet name="footer">
</f:facet>
- How to calculate ADF table column
- How to use listeners on ADF Table Tree TreeTable
- how to calculate ANOVA
- MySQL: How to add column to existing table
- ADF How To
- Oracle table fragmentation how to calculate or get the actual used blocks of the table
- MySQL How to add a column in a table?
- How to calculate t distributions
- ADF HOW TO: How to stop adf:Poll
- How to customize ADF exception
- [整理] How to calculate DECOUPLING CAPACITANCE
- How to Calculate Your Shared Pool Size
- How to calculate CRC in C#?
- How to calculate the undo_retention time
- How to Calculate IP/TCP/UDP Checksum
- how to calculate receptive field of CNN
- How To Change the Partition Column Of A Partitioned Table Using DBMS_Redefinition [ID 846405.1]
- How To Change the Partition Column Of A Partitioned Table Using DBMS_Redefinition [ID 846405.1]
- 今日APPS:手机戒瘾法宝Forest 拒当低头族
- [leetcode] Word Break II
- java数据库--JDBC
- WP开发环境配置过程中遇到的问题总结
- HDU4882
- How to calculate ADF table column
- OpenGL: 屏幕坐标向OpenGL坐标转换
- UVA - 825Walking on the Safe Side(dp)
- 对FlexLite和MoreUI的评价
- 段永基说四通公司的失败(上)
- 段永基说四通公司的失败(中)
- HDU 1863 畅通工程
- sqlite学习笔记8:C语言中使用sqlite之创建表
- HDU4937