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中插入数据时,新增行总是在当前页的最后一行的更多相关文章

  1. 触发器修改后保存之前的数据 表中插入数据时ID自动增长

    create or replace trigger t before update on test5 for each rowbegin insert into test55 values (:old ...

  2. 数据库中插入数据时发生ora-00984错误

    操作Oracle数据库,插入数据时显示:ORA-00984列在此处不允许错误,如下图所示: 出现的原因是由于,在插入字符或字符串型字段时.如果插入的数据是纯数字,则不会有错误:如果出现字符,则会报OR ...

  3. 在向"带有自增字段的数据库表"中插入数据时,自定义"该自增字段"的数据

    在设计数据库表的时候,经常会使用自增主键或其他自增字段.比如: DB_UserGroups表中GroupID为该表主键,并为自增字段. 但在将某字段设置自增后,想在插入数据时,人为指定自增字段的数据内 ...

  4. 在Sql2005中,向表中插入数据时遇到uniqueidentifier列,如何插入数据?

    Sql2005中,提供了uniqueidentifier 数据类型.说白了,就是个GUID,这种类型开发时倒是很有必要的. 今天程序中遇到了这个问题:表里定义了一个uniqueidentifier 列 ...

  5. MYSQL中插入数据时出现的问题:

    问题: mysql',default,default); ERROR (HY000): Incorrect string value: 解决方案: 首先查看自己的数据表情况: mysql> SH ...

  6. 向已有的table中插入数据

    table: <table id="seleted-table" class="table table-bordered table-hover" sty ...

  7. django rest framework 向数据库中插入数据时处理外键的方法

    一.models.py中 from django.db import models class UserModel(models.Model) user_name = models.CharField ...

  8. 向mysql数据库中插入数据时显示“Duplicate entry '1′ for key ‘PRIMARY' ”错误

    错误情况如题,出现这个错误的原因十分简单: 很明显,这是主键的问题. 在一张数据表中是不能同时出现多个相同主键的数据的 这就是错误的原因,解决的方法: 1.可以将这张表设置成无主键(mysql支持,其 ...

  9. 使用 QSqlTableModel 模型向数据库中插入数据时,为什么使用 rowCount 函数只能返回 256 最大值?

    默认返回缓冲区里面的数据,如果你向要获取更多值,请在前面加入以下语句即可. while(model.canFetchMore()){ model.fetchMore(); } 该语句会获取更多的记录.

随机推荐

  1. 【转】jQuery.ajax向后台传递数组问题

    $.ajax({ url: "/xxx", type: "GET", data: { "boxIds": boxIds, "box ...

  2. HDU_5521_Meeting

    Meeting Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total ...

  3. 2.5 – Garbage Collection 自动垃圾回收 Stop-the-world vs. incremental vs. concurrent 垃圾回收策略

    2.5 – Garbage Collection  自动垃圾回收 Lua 5.3 Reference Manual http://www.lua.org/manual/5.3/manual.html# ...

  4. stark - 分页、search、actions

    一.分页 效果图 知识点 1.分页 {{ showlist.pagination.page_html|safe }} 2.page.py class Pagination(object): def _ ...

  5. Python高级编程技巧(转)

    译文:http://blog.jobbole.com/61171/ 本文展示一些高级的Python设计结构和它们的使用方法.在日常工作中,你可以根据需要选择合适的数据结构,例如对快速查找性的要求.对数 ...

  6. Ubuntu18.04下安装比特币客户端

    一.下载有两种安装方式:安装包和源码 二.安装1.通过安装包安装在https://bitcoin.org/en/download下载Windows,Mac OSX,Linux对应的安装包.安装过程比较 ...

  7. Day19 客户关系系统实战

    day19 今日内容 Service事务 客户关系管理系统     Service事务 在Service中使用ThreadLocal来完成事务,为将来学习Spring事务打基础! 1 DAO中的事务 ...

  8. idea中添加模板。

    1:点击File>settings>live template 2: 在 Editor界面下,点击右上角 + 好, 如果想添加一个新类型的语言,点击templateGroup  输入组名. ...

  9. [py]python的深拷贝和浅拷贝

    Python深复制浅复制or深拷贝浅拷贝 简单点说 copy.copy 浅拷贝 只拷贝父对象,不会拷贝对象的内部的子对象. copy.deepcopy 深拷贝 拷贝对象及其子对象 用一个简单的例子说明 ...

  10. Mybatis一对一映射

    一.Mybatis一对一映射 本例讲述使用mybatis开发过程中常见的一对一映射查询案例.只抽取关键代码和mapper文件中的关键sql和配置,详细的工程搭建和Mybatis详细的流程代码可参见&l ...