CODE IN CO

  1. OATableBean table =
  2. (OATableBean)webBean.findChildRecursive("LineTable");
  3. int numOfRowsDisplay = table.getNumberOfRowsDisplayed();
  4. Serializable[] param01 = { new Number(numOfRowsDisplay) };
  5. Class[] classType = new Class[] { Number.class, };
  6. am.invokeMethod("addPlanLines", param01, classType);

CODE IN AM

  1. public void addPlanLines(Number numOfDisplay) {
  2. OADBTransaction tsn = this.getOADBTransaction();
  3.  
  4. CuxPosAuditPlanLinesFullVOImpl lineVO =
  5. getCuxPosAuditPlanLinesFullVO();
  6. Number planId = getPlanId();
  7.  
  8. lineVO.setMaxFetchSize(0);
  9. if (!lineVO.isPreparedForExecution()) {
  10. lineVO.setWhereClause(null);
  11. lineVO.executeQuery();
  12. }
  13.  
  14. RowSet localRowSet = lineVO.getRowSet();
  15.  
  16. int i = 1;
  17. int j = numOfDisplay.intValue();
  18. int rangeStart = localRowSet.getRangeStart();
  19. int rangeSize = localRowSet.getRangeSize();
  20. int rowCountInRange = localRowSet.getRowCountInRange();
  21. int i1;
  22. if (rowCountInRange + i <= j)
  23. i1 = rowCountInRange;
  24. else {
  25. i1 = j - i;
  26. }
  27. CuxPosAuditPlanLinesFullVORowImpl row =
  28. (CuxPosAuditPlanLinesFullVORowImpl)lineVO.createRow();
  29. if (rangeSize < i1) {
  30. rangeSize++;
  31. localRowSet.setRangeSize(rangeSize);
  32. localRowSet.setRangeStart(rangeStart);
  33. }
  34.  
  35. row.setPlanId(planId);
  36. Number pk = getSequenceValue("CUX_POS_AUDIT_PLAN_LINES_S");
  37. row.setLineId(pk);
  38. row.setOrgId(new Number(tsn.getOrgId()));
  39. row.setOrgName(getOrgName(tsn.getOrgId()));
  40. localRowSet.insertRowAtRangeIndex(i1, row);
  41. localRowSet.setCurrentRowAtRangeIndex(i1);
  42. }

方法二:


  1. /**
  2. * This method is for use with UI Table addRows buttons that require the
  3. * addition of multiple rows; given a RowIterator (such as a VO) and the
  4. * number of rows the caller needs to add, this method figures out where
  5. * the caller should start adding rows in order to comply with the BLAF
  6. * standard that newly added rows should go into the bottom of the current
  7. * table range (which is the same as the RowIterator range if things are
  8. * set up properly), pushing rows into the next range if necessary
  9. *
  10. * Returns: range-based (not absolute) index within the current range
  11. */
  12. public static int getStartIndexForMultiInsert(RowIterator rowIt, int numRowsToAdd)
  13. {
  14. int numRowsInRange = rowIt.getRowCountInRange();
  15. int rangeSize = rowIt.getRangeSize();
  16. int firstIndexAtWhichToAdd = 0;
  17. int numOpenSlotsInRange = (rangeSize - numRowsInRange);
  18.  
  19. if (rowIt.getRangeSize() < rangeSize)
  20. {
  21. rowIt.setRangeSize(rangeSize);
  22. }
  23.  
  24. if (numOpenSlotsInRange < numRowsToAdd)
  25. {
  26. firstIndexAtWhichToAdd = rangeSize - numRowsToAdd;
  27. }
  28. else
  29. {
  30. firstIndexAtWhichToAdd = numRowsInRange;
  31. }
  32.  
  33. return firstIndexAtWhichToAdd;
  34. }
  35.  
  36. 调用:
  37. int indexForRowInserts = getStartIndexForMultiInsert(vo, 1);
  38. vo.insertRowAtRangeIndex(indexForRowInserts,row);

方法三:

这种方法有点小问题:

仅仅在第一页有效,应该可以再修改修改,懒得改了

  1. calculVO.insertRow(row);
  2. int fetched = calculVO.getFetchedRowCount();
  3. fetched = fetched > 9 ? 9 : fetched;
  4. if (fetched > 0)
  5. {
  6. int current = fetched % 10;
  7. if (current == 0)
  8. {
  9. fetched = 9;
  10. } else
  11. {
  12. fetched = current > 9 ? 9 : current;
  13. }
  14. }
  15. 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. PL/SQL编程基础(五):异常处理(EXCEPTION)

    异常处理 异常产生所带来的问题: 使用EXCEPTION程序块进行异常处理: 实现用户自定义异常. 使用异常可以保证在程序中出现运行时异常时程序可以正常的执行完毕: 用户可以使用自定义异常进行操作. ...

  2. redis cluster 集群畅谈(二)

    上一篇http://www.cnblogs.com/qinyujie/p/9029482.html, 主要讲解 redis cluster 集群 搭建,本篇主要讲解实验多master写入.读写分离.实 ...

  3. 关于volatile 最完整的一篇文章

    你真的了解volatile关键字吗? 一.Java内存模型 想要理解volatile为什么能确保可见性,就要先理解Java中的内存模型是什么样的. Java内存模型规定了所有的变量都存储在主内存中.每 ...

  4. 正则表达式,以python为例

    转载需注明原文地址和作者两项内容. 正则表达式目的是能够快速处理字符串内容,主要用于找出指定的字符串,配合其他操作完成任务.使用正则表达式时要了解自己语言的特性,python中的正则表达式默认情况是贪 ...

  5. java打印随机函数

    一 ,打印1-10的随机函数 public static void randomprint(){      for (int i=0;i<100;i++){          //打印一百次  ...

  6. Saltstack数据系统

    1.grainsgrains 是在 minion(客户端)启动时收集到的一些信息,比如操作系统类型.网卡ip等.强调是minion启动时收集到的数据,所以如果改了什么硬件啥的,要重启minion才能收 ...

  7. (转)SQL Server 2008登录错误:无法连接到(local)的解决

    在一些朋友安装完SQL Server 2008之后大多会遇到连接出错的问题.特别对于我们这样的新手而言简直郁闷的要死,好不容易装玩了又出现了问题.此篇文章意在解决安装步骤没有问题,但安装后无法登录的问 ...

  8. Django:学习笔记(9)——视图

    Django:学习笔记(9)——视图 基础视图 基于函数的视图,我们需要在使用条件语句来判断请求类型,并分支处理.但是在基于类的视图中,我们可以在类中定义不同请求类型的方法来处理相对应的请求. 基于函 ...

  9. 系统管理命令之tty

    在Linux操作系统中,所有外围设备都有其名称与代号,这些名称代号以特殊文件的类型存放于/dev目录下.你可以执行tty指令查询目前使用的终端机的文件名称. 1.命令帮助: # tty -- help ...

  10. 2018-2019 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) Solution

    A:Exam Solved. 温暖的签. #include<bits/stdc++.h> using namespace std; ; int k; char str1[maxn], st ...