向多页TABLE中插入数据时,新增行总是在当前页的最后一行
CODE IN CO
OATableBean table =
(OATableBean)webBean.findChildRecursive("LineTable");
int numOfRowsDisplay = table.getNumberOfRowsDisplayed();
Serializable[] param01 = { new Number(numOfRowsDisplay) };
Class[] classType = new Class[] { Number.class, };
am.invokeMethod("addPlanLines", param01, classType);
CODE IN AM
public void addPlanLines(Number numOfDisplay) {
OADBTransaction tsn = this.getOADBTransaction(); CuxPosAuditPlanLinesFullVOImpl lineVO =
getCuxPosAuditPlanLinesFullVO();
Number planId = getPlanId(); lineVO.setMaxFetchSize(0);
if (!lineVO.isPreparedForExecution()) {
lineVO.setWhereClause(null);
lineVO.executeQuery();
} RowSet localRowSet = lineVO.getRowSet(); int i = 1;
int j = numOfDisplay.intValue();
int rangeStart = localRowSet.getRangeStart();
int rangeSize = localRowSet.getRangeSize();
int rowCountInRange = localRowSet.getRowCountInRange();
int i1;
if (rowCountInRange + i <= j)
i1 = rowCountInRange;
else {
i1 = j - i;
}
CuxPosAuditPlanLinesFullVORowImpl row =
(CuxPosAuditPlanLinesFullVORowImpl)lineVO.createRow();
if (rangeSize < i1) {
rangeSize++;
localRowSet.setRangeSize(rangeSize);
localRowSet.setRangeStart(rangeStart);
} row.setPlanId(planId);
Number pk = getSequenceValue("CUX_POS_AUDIT_PLAN_LINES_S");
row.setLineId(pk);
row.setOrgId(new Number(tsn.getOrgId()));
row.setOrgName(getOrgName(tsn.getOrgId()));
localRowSet.insertRowAtRangeIndex(i1, row);
localRowSet.setCurrentRowAtRangeIndex(i1);
}
方法二:
/**
* This method is for use with UI Table addRows buttons that require the
* addition of multiple rows; given a RowIterator (such as a VO) and the
* number of rows the caller needs to add, this method figures out where
* the caller should start adding rows in order to comply with the BLAF
* standard that newly added rows should go into the bottom of the current
* table range (which is the same as the RowIterator range if things are
* set up properly), pushing rows into the next range if necessary
*
* Returns: range-based (not absolute) index within the current range
*/
public static int getStartIndexForMultiInsert(RowIterator rowIt, int numRowsToAdd)
{
int numRowsInRange = rowIt.getRowCountInRange();
int rangeSize = rowIt.getRangeSize();
int firstIndexAtWhichToAdd = 0;
int numOpenSlotsInRange = (rangeSize - numRowsInRange); if (rowIt.getRangeSize() < rangeSize)
{
rowIt.setRangeSize(rangeSize);
} if (numOpenSlotsInRange < numRowsToAdd)
{
firstIndexAtWhichToAdd = rangeSize - numRowsToAdd;
}
else
{
firstIndexAtWhichToAdd = numRowsInRange;
} return firstIndexAtWhichToAdd;
} 调用:
int indexForRowInserts = getStartIndexForMultiInsert(vo, 1);
vo.insertRowAtRangeIndex(indexForRowInserts,row);
方法三:
这种方法有点小问题:
仅仅在第一页有效,应该可以再修改修改,懒得改了
calculVO.insertRow(row);
int fetched = calculVO.getFetchedRowCount();
fetched = fetched > 9 ? 9 : fetched;
if (fetched > 0)
{
int current = fetched % 10;
if (current == 0)
{
fetched = 9;
} else
{
fetched = current > 9 ? 9 : current;
}
}
calculVO.insertRowAtRangeIndex(fetched, row);
向多页TABLE中插入数据时,新增行总是在当前页的最后一行的更多相关文章
- 触发器修改后保存之前的数据 表中插入数据时ID自动增长
create or replace trigger t before update on test5 for each rowbegin insert into test55 values (:old ...
- 数据库中插入数据时发生ora-00984错误
操作Oracle数据库,插入数据时显示:ORA-00984列在此处不允许错误,如下图所示: 出现的原因是由于,在插入字符或字符串型字段时.如果插入的数据是纯数字,则不会有错误:如果出现字符,则会报OR ...
- 在向"带有自增字段的数据库表"中插入数据时,自定义"该自增字段"的数据
在设计数据库表的时候,经常会使用自增主键或其他自增字段.比如: DB_UserGroups表中GroupID为该表主键,并为自增字段. 但在将某字段设置自增后,想在插入数据时,人为指定自增字段的数据内 ...
- 在Sql2005中,向表中插入数据时遇到uniqueidentifier列,如何插入数据?
Sql2005中,提供了uniqueidentifier 数据类型.说白了,就是个GUID,这种类型开发时倒是很有必要的. 今天程序中遇到了这个问题:表里定义了一个uniqueidentifier 列 ...
- MYSQL中插入数据时出现的问题:
问题: mysql',default,default); ERROR (HY000): Incorrect string value: 解决方案: 首先查看自己的数据表情况: mysql> SH ...
- 向已有的table中插入数据
table: <table id="seleted-table" class="table table-bordered table-hover" sty ...
- django rest framework 向数据库中插入数据时处理外键的方法
一.models.py中 from django.db import models class UserModel(models.Model) user_name = models.CharField ...
- 向mysql数据库中插入数据时显示“Duplicate entry '1′ for key ‘PRIMARY' ”错误
错误情况如题,出现这个错误的原因十分简单: 很明显,这是主键的问题. 在一张数据表中是不能同时出现多个相同主键的数据的 这就是错误的原因,解决的方法: 1.可以将这张表设置成无主键(mysql支持,其 ...
- 使用 QSqlTableModel 模型向数据库中插入数据时,为什么使用 rowCount 函数只能返回 256 最大值?
默认返回缓冲区里面的数据,如果你向要获取更多值,请在前面加入以下语句即可. while(model.canFetchMore()){ model.fetchMore(); } 该语句会获取更多的记录.
随机推荐
- AngularJs:Directive指令用法
摘自:http://www.jb51.net/article/83051.htm 摘要:Directive(指令)是AngularJ非常强大而有有用的功能之一.它就相当于为我们写了公共的自定义DOM元 ...
- Kafka集群部署 (守护进程启动)
1.Kafka集群部署 1.1集群部署的基本流程 下载安装包.解压安装包.修改配置文件.分发安装包.启动集群 1.2集群部署的基础环境准备 安装前的准备工作(zk集群已经部署完毕) 关闭防火墙 c ...
- python之redis模块
一.redis简介 redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(s ...
- mysql查询表和字段的注释
1,新建表以及添加表和字段的注释. create table t_user( ID INT(19) primary key auto_increment comment '主键', ...
- Jenkins时区设置
系统管理->脚本命令行 System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')
- c# ArrayList 的排序问题!
2009-01-19 20:10 c# ArrayList 的排序问题! c# ArrayList 的排序问题! 我看见网上有人用IComparer接口实现ArrayLIst 的排序问题 ,于是自己写 ...
- Ubuntu16.04桌面系统如何配置和启动wireshark
上一篇介绍了在Ubuntu系统中安装wireshark 本篇介绍在Ubuntu系统中配置和启动wireshark: 安装好后,直接在终端运行$ wireshark.出于安全方面的考虑,普通用户不能够打 ...
- [OpenCV入门教程之十二】OpenCV边缘检测:Canny算子,Sobel算子,Laplace算子,Scharr滤波器合辑
http://blog.csdn.net/poem_qianmo/article/details/25560901 本系列文章由@浅墨_毛星云 出品,转载请注明出处. 文章链接:http://blog ...
- 前端学习笔记之HTML/CSS 速写神器 Emmet
HTML/CSS 速写神器:Emmet 在前端开发的过程中,一个最繁琐的工作就是写 HTML.CSS 代码.数量繁多的标签.属性.尖括号.标签闭合等,让前端们甚是苦恼.于是,我向大家推荐 Emmet, ...
- P1052 过河(离散化+dp)
P1052 过河 dp不难,重点是要想到离散化. 石子个数$<=100$意味着有大量空间空置,我们可以缩掉这些空间. 实现的话自己yy下就差不多了. #include<iostream&g ...