zoukankan      html  css  js  c++  java
  • FineReport——获取控件值和单元格值

     设置单元格的值(填报预览):

    //contentPane.setCellValue(1,0,"abc");//参数面板给单元格赋实际值,即可填报
    contentPane.curLGP.setCellValue(1, 0, "abc") //报表中控件给报表中单元格赋值

    获取单元格的值(填报预览,参数面板和报表控件都可以这样写):

    //contentPane.getCellValue(1,0);
    contentPane.curLGP.getCellValue(1, 0)
    var text=contentPane.curLGP.getCellValue("D2");//获取文本框控件所在单元格的值 
    contentPane.getCellValue(sheet号,列号,行号);  //sheet号行号列号是从0开始
    contentPane.curLGP.getCellValue(列号,行号);  
    contentPane.curLGP.getCellValue(单元格);   

    当前控件值:

    this.getValue();

    复模版和次模板:

    this.options.form/window.parent.form

    参数界面获取参数界面控件:

    var Widget = this.options.form.getWidgetByName("WidgetName"); //控件名

    参数界面获取报表中控件:

    var value= contentPane.getWidgetByName("textbox").getValue(); //textbox为在报表中定义控件时命名

    报表中控件获取参数面板中控件:

    var Widget = contentPane.parameterEl.getWidgetByName("id");
    在这种情况下,就可以使用_g().parameterCommit();。

    报表中控件获取报表中控件:

    var Widget=contentPane.getWidgetByName("tab");

    在web页面中获取FineReport报表里面的参数界面:

    document.getElementById('reportFrame').contentWindow.contentPane.parameterEl.getWidgetByName('widgetname')

    工具栏按钮获取参数面板控件:

    var temp= contentPane.parameterEl.options.form.getWidgetByName("temp").getValue();

    填报属性页面事件获取参数面板控件:

    contentPane.parameterEl.getWidgetByName("widget").getValue();
    

    控件的常用方法:

    Widget.setValue()该方法是给控件赋值,但是不建议在填报页面用该方法给控件赋值,因为这是给控件赋值,并不是单元格,在填报的时候如果使用该方法赋值,每次给控件赋值完成之后,将值传给单元格之前,会被清空,最后单元格的值还是为空,所以在填报页面建议使用setCellValue()给控件赋值。

    获取父模板:

    var form = window.parent.form; 

    获取/设置制定参数控件的值:

    var pva=form.getWidgetByName("p2").getValue();
    //this.options.form.getWidgetByName("p1").getValue();
    form.getWidgetByName("p2").setValue(pva);

    通过引入finereport.js,就可以使用FR这个对象:

    <script type="text/javascript" src="/WebReport/ReportServer?op=emb&resource=finereport.js"></script>
    doURLFlashPrint(printurl,isPopUp) //第一个参数代表路径,第二个表示是否弹出对话框

    获取当前单元格行列号:

    var row =contentPane.curLGP.getTDRow(td);   
    var col =contentPane.curLGP.getTDCol(td);  

    获取工具栏的控件:

    var toolbar = contentPane.toolbar;
    
    var items = toolbar.options.items;
    
    var customButton=items[2];//JQUERY取我们的工具栏上的按钮.items[2]代表的是第三个。

     刷新事件(添加按钮点击事件):

    location.reload();

    自定义提交:

    _g('${sessionID}').writeReport();  

    自定义校验提交:

    _g('${sessionID}').verifyAndWriteReport();

    自定义查询:

    _g().parameterCommit();  

    点击页面弹出子页面,按钮的点击事件:

    FR.showIframeDialog({
    
    url:"ReportServer?reportlet=SMES/NewAdd.cpt&op=write",
    
    title:"title",
    
    600,
    
    height:600
    
    })
    
    或者
    
    FR.showDialog("测试", 400, 400, "<div> <iframe  id='reportFrame' style='100%;height:350px' src='http://localhost:8075/WebReport/ReportServer?reportlet=SMES/NewEdit.cpt&op=write&PKID=${CopID}'> </iframe></div>", {collapsible:true});

    子页面刷新父页面:

    在父页面做个按钮,ID为btnRefresh  点击事件为:location.reload();

    在子页面的填报成功事件里写:

    var top = window.parent;
    
    var reportPane = top.contentPane;
    
    var btn = reportPane.curLGP.write.getWidgetByName("btnRefresh");
    
    btn.fireEvent("click");

     网页框路径:

    ${servletURL}?reportlet=tree2/relation.cpt&op=write 

    刷新整个页面:

    location.reload();

    刷新当前sheet:

    this.refreshAllSheets();

    刷新报表而不刷新参数面板:

    contentPane.reloadCurLGPPane();

     当前单元格的值:

    $$$

    为空不过滤:nofilter表示不过滤,if(len($area)==0,nofilter,$area)表示参数area为空,就不过滤,若不为空则以参数值进行过滤。

     获取当前行号并赋值给F1:

    contentPane.on("cellselect", function(td) {  //获取单元格被选中监听事件  
      var num =contentPane.curLGP.getTDRow(td)-2;  //获取当前行号,由于数据是从第三行开始,因此要减2  
      contentPane.curLGP.setCellValue("F1",null,num);  //给F1单元格赋值  
    });

     给下拉框使用公式定义数据集:实际值:sql公式,显示值:sql公式+"id=$$$"

    在公式中使用数据集名称:

    dsname.select(colname,筛选条件1&&筛选条件2&&......) //ds中不能使用参数
  • 相关阅读:
    mvc5+ef6+Bootstrap 项目心得--创立之初
    C# StopWatch的使用
    MVC Form异步请求
    bootstrap-datepicker带中文的js文件
    bootstrap
    mvc5+ef6+Bootstrap 项目心得--WebGrid
    mvc5+ef6+Bootstrap 项目心得--身份验证和权限管理
    关于mvc5+EF里面的db.Entry(model).State = EntityState.Modified报错问题
    将DBF文件导入Sqlserver数据库
    MySQL主从报错解决:Failed to initialize the master info structure
  • 原文地址:https://www.cnblogs.com/ytwy/p/4864329.html
Copyright © 2011-2022 走看看