您的位置:首页 > 其它

润乾报表行式填报表可写控制

2016-11-29 19:22 274 查看

需求

行式填报表页面要有可编辑和不可编辑按钮,单击不可编辑后,报表就不能填写数据了;单击可编辑按钮,报表可以填写数据。

制作报表

行式填报表制作如下,其中带有下拉日历、下拉树、下拉数据集、下拉列表,在后面我们会看到对他们的设置有所不同。



制作发布报表JSP

<%@ page contentType="text/html;charset=GBK" %>

<%@ taglib uri="/WEB-INF/runqianReport4.tld" prefix="report" %>

<%@ page import="java.io.*"%>

<%@ page import="java.util.*"%>

<%@ page import="com.runqian.report4.usermodel.Context"%>

 

<html>

<body>

<input id="abc" type="button"

                                     onclick="setReportWritable(document.getElementById('report1'), false)"

                                     value="不可编辑" />

                                     <input id="abc" type="button"

                                     onclick="setReportWritable(document.getElementById('report1'), true)"

                                     value="编辑" />

<table >

         <tr><td>

                   <report:html  name="report1" reportFileName="test.raq"

                            funcBarLocation="top"

                            needPageMark="yes"

                            generateParamForm="no"

                            exceptionPage="/reportJsp/myError2.jsp"

                   />

         </td></tr>

</table>

 

<script language="javascript">

         var temp=new Array();

         var row=document.getElementById("report1").rows.length;  //请注意此处的写法

         for(var i=0;i<row;i++)

         {

           temp[i]=new Array();

           var currRow=document.getElementById("report1").rows[i];

            for(var col=0;col<currRow.cells.length;col++)

                   {

              var currCell=currRow.cells[col];

                    temp[i][col]=currCell.onclick;

                   }

          }

 

         //设置报表的单元格是否可写,

         //所需要的值为:报表的对象,和boolean值,true为可写,false为不可写

         function setReportWritable(report_table, writable) {

                   var _input_report_writable = writable;//设置为是否可写,boolean类型

        

                   for ( var row = 0; row < report_table.rows.length; row++) {

                            var currRow = report_table.rows[row];//取得行

                            for ( var col = 0; col < currRow.cells.length; col++) {

                                     var currCell = currRow.cells[col];//取得指定行列(单元格)

                                     if (!writable) {//设置为不可写(填)

                                               currCell.onclick = _hideEditor;

                                     } else {//设置报表为可写(填)

                            if(currCell.editStyle==6){

                                               currCell.onclick = function anonymous() { _hideEditor(); _runqianCalendar.dateFormat='yyyy-MM-dd HH:mm:ss';  //请注意此处的写法

 _runqianCalendar.type= 'date';  //请注意此处的写法

_showCalendar();_setRowColBackColor(this) };

                                     }

                                     else if(currCell.editStyle==8){

                                     currCell.onclick=temp[row][col];

                                                        }

                                               else{

                                               currCell.onclick=_displayEditor;

                                     }

                                     }

                            }

                   }

         }

</script>

 

</body>

</html>

 

访问该jsp即可看到效果。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息