执行注册事件【onRenderGrid】出错:Error: 参数无效

5401
5

a88118115 数据小白Lv1

发表于2018-9-12 09:45

悬赏1

已解决

楼主


JavaScript StackTrace:
function(eventType, args) {
    try {
      return this._eventHandler.fireEvent(eventType, args);
    } catch (e) {
      showError('执行注册事件【' + eventType + '】出错:' + e);
    }
  }

function(){
    this._bindGridCellDom();//绑定DOM
//    this._renderHeaderCells();//渲染表头 =>该行挪到_finishLoad方法后调用
    this.fireEvent(XGrid.EVENT_ON_GRID_RENDER, [ this ]);// 执行渲染注册事件
  }

function() {
    this._hasloaded = false;
    var gridHtml = [];//表格HTML字符串数组
    gridHtml.push(this._spliceHeaderHtml());//表头
    var gridConfig = this.getConfig();
    gridHtml.push(this._spliceGridHtml(gridConfig["gridLeft"], gridConfig["gridTop"], gridConfig["cells"], gridConfig["rowHeights"], gridConfig["columnWidths"], {tdstyle: 'overflow: hidden; magin: 0; white-space: nowrap; zoom: 1;'}));//表格
    this._mainDiv.innerHTML = gridHtml.join('');
    this._initRender();
    this._initEvents();
  }

function(option){
    /* 放ftl中,提高性能
    addStyle("def_c", XGrid.DEFAULT_CELL_STYLE, this._doc);//默认样式. 没有指定表元样式时,将默认使用此样式。
    */
    var _panelConfig = {
        invisible: this._islinkreport,
        gridTop: this._gridConfig["gridTop"],
        gridLeft: this._gridConfig["gridLeft"],
        rowHeights: this._gridConfig["rowHeights"].concat(),
        columnWidths: this._gridConfig["columnWidths"].concat(),
        oncontext : this,
        onGridLeftChangedFunc: this._setGridLeft,
        onGridTopChangedFunc: this._setGridTop,
        onRowHeightChangedFunc: this._setRowHeight,
        onRowHeightsChangedFunc: this._setRowHeights,
        onColumnWidthChangedFunc: this._setColumnWidth,
        onColumnWidthsChangedFunc: this._setColumnWidths,
        onGridScrollChangedFunc: _scroll_change_
    };
   
    this._rowColScrollPanel = new RowColumnScrollPanel(this._win, this._container, _panelConfig);
    //如果行列面板不可见 在初始化时就设置为不可见
    if (!this._webTask.getTaskInfo("rowHeaderVisible")) {
      this.setRowHeaderVisible(false);
    }
    if (!this._webTask.getTaskInfo("colHeaderVisible")) {
      this.setColumnHeaderVisible(false);
    }
    this._mainDiv = this._rowColScrollPanel.getMainContainer();
    this._mainDiv.style.backgroundColor = this._gridConfig["backgroundColor"];
    this._mainDiv.style.lineHeight = 'normal';
    var __WebTask = com.esen.i.js.webreport.WebTask;
    this._mainDiv.setAttribute(__WebTask.SOURCE_ATTNAME, __WebTask.SOURCE_REPORT);
    this._initEventHandle(option ? option["events"] : null);
    this._initGridDom();
    disableDocTextSelect(this._container);
  }

function(option){
    XGrid.prototype._init.apply(this, arguments);
    this._initStyleExpSequence();
    if (this._islinkreport) return;
    //处理报表背景图片设置
    var bkpictureName = this.getOption("bkpicture_name");
    if(bkpictureName){
      var src = com.esen.i.js.webreport.WebTask.ACTION_URL+"?service=loadattach&taskid="+this._webTask.getUserData("taskid")+"&fileName="+bkpictureName;
      var bkpicturedispstyle = this.getOption("bkpicture_dispstyle");
      if(bkpicturedispstyle == 0) {//原始大小
        this._mainDiv.style.background = "url(" + src + ") no-repeat";
      } else if(bkpicturedispstyle == 3) {//平铺
        this._mainDiv.style.background = "url(" + src + ") repeat";
      } else if(bkpicturedispstyle == 2) {//拉伸
        if (ieVersion <= 8) {//IE8不支持background-size样式,所以特殊处理 IRPT-19592 edit by chenf
          var _img = this._mainDiv.appendChild(this._doc.createElement("img"));
          _img.style.cssText += '; width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 0';
          _img.src = src;
        } else {
          this._mainDiv.style.cssText += '; background-image:url(' + src + '); background-repeat: no-repeat; background-size: 100% 100%; -webkit-background-size: 100% 100%; -moz-background-size: 100% 100%;';
        }
      }                          //IRPT-18435 web填报舍位平衡数据集没有底纹 //IRPT-18975 对不参与舍位平衡的表不显示底纹 edit by ligl
    } else if ((this._webTask.getTaskInfo("swph")||this._webTask._dataConfig["ds"]=="SWPH")&&this.getOption("needadjust")) { //舍位平衡时,需要边线
      this._mainDiv.style.background = 'url(../ei/webreport/js/xgrid/image/horiz.gif) repeat';
    }
  }

function(win, container, width, height, webTask, gridConfig, dataStore, option){
    if (_biInPrototype)
      return;
    this._rowVisArr = [];
    this._colVisArr = [];
    XGrid.call(this, win, container, width, height);
    this._webTask = webTask;
    this._needSubmit = false;//是否修改了数据或者填写了数据 初始默认为false
    if( gridConfig ){
      this._gridConfig = this._applyConfig(gridConfig);
      this.setDataStore(dataStore);
      this._init(option);
    }
  }

function(win, container, width, height, webTask, gridConfig, dataStore, option){
    if(!gridConfig) return null;
    if(gridConfig['options'] && gridConfig['options']['reportType'] === WebReport.TYPE_PLANAR)
      return com.esen.i.js.webreport.WebReport2.create(win, container, width, height, webTask, gridConfig, dataStore, option);
    return new WebReport(win, container, width, height, webTask, gridConfig, dataStore, option);
  }

function _createLinkReport(gridConfig, obj){
      try{
        gridConfig["islinkreport"] = true;
        if(gridConfig["oriRowHeights"]){//如果有保存原始行高列宽,则恢复原始行高列宽(可能链接表的原表行高列宽已经被用户更改)
          gridConfig["rowHeights"] = gridConfig["oriRowHeights"];
          gridConfig["columnWidths"] = gridConfig["oriColumnWidths"];
        } else {//没有保存的话,则需要保存,否则在调整链接表的行高列宽时会计算异常
          gridConfig["oriRowHeights"] = gridConfig["rowHeights"];
          gridConfig["oriColumnWidths"] = gridConfig["columnWidths"];
        }
        if (copypcw) {
          var fc = copypcw["fc"], tc = copypcw["tc"];
          if (gridConfig["columnWidths"].length === tc - fc) { // 只有列数一致才允许同步
            gridConfig["columnWidths"] = gridConfig["oriColumnWidths"] = copypcw["rpt"].getConfig("columnWidths").slice(fc, tc);
          } else {
            copypcw = false;
          }
        }
        var dataStore = webtask.getDataStore(rptName), _linkRelevanceReport = webtask._linkRelevanceReport;
        td.style.padding = 0; // 默认padding为"0 3px",这里需要还原成0
        var shadeDiv = td.appendChild(obj._doc.createElement("div"));
        shadeDiv.style.cssText += '; position: relative; left: 0; top: 0; width: 100%; height: 100%; z-index: 100; border: none';
        shadeDiv.className = xcell.cellStyle;
        var rpt = WebReport.create(obj._win, td, '100%', '100%', webtask, gridConfig, dataStore, {
              events : [ {
                type : XGrid.EVENT_ON_GRID_RENDER,
                func : function(rpt) {
                  var _table = rpt._table, _rows = _table.rows, colWidths = rpt.getConfig("oriColumnWidths"), firstrow = _rows[0],
                    extwLeft = parseFloat(getCurrentStyle(_table, "border-left-width"), 10) || 0,
                    extwRight = parseFloat(getCurrentStyle(_table, "border-right-width"), 10) || 0;
                  if (firstrow) { // 这里因为去掉了表格周边的边框,因此第一列和最后一列的宽度需要重新调整,减去边框的大小
                    var firstcell = firstrow.firstChild, lastcell = firstrow.lastChild;
                    if (firstcell) {
                      extwLeft += parseFloat(getCurrentStyle(firstcell, "border-left-width"), 10) || 0;
                      extwRight += parseFloat(getCurrentStyle(lastcell, "border-right-width"), 10) || 0;
                      while (firstcell) { //清除第一行的上边框
                        firstcell.style.borderTop = 'none';
                        firstcell = firstcell.nextSibling;
                      }
                      if (rpt.getRowHeight(0) === 0) rpt._container.style.borderTop = 'none'; // 第一行隐藏时需要把上层td的上边框隐藏
                    }
                    if (typeof (rpt._leftPlanarBorderWidth) != 'undefined') {
                      extwLeft = rpt._leftPlanarBorderWidth;
                      extwRight = rpt._rightPlanarBorderWidth;
                      rpt._leftPlanarBorderWidth = 0;
                      rpt._rightPlanarBorderWidth = 0;
                    }
                    var rlen = rpt.getRowCount() - 1, clen = rpt.getColCount(), lastrow = _rows[rlen], cells = rpt.getConfig("cells");
                    var cwidths = rpt.getConfig("columnWidths"), fc = 0, tc = clen - 1, dataRow = rpt._dataRow;
                    while (cwidths[fc] === 0) {
                      if ((++fc) >= clen) break;;
                    }
                    for ( var i = 0, ifr = 0, itr = 0; i <= rlen; i++) {
                      if (dataRow === i) {
                        /**
                         * IRPT-19084 add by chenf 2015-7-21
                         * 遇到变长行时需要同步增加ifr和itr,否则会造成后面的行无法匹配而行索引而导致最后左右边框未去掉
                         */
                        var _td = _rows.firstChild, rs = _td.rowSpan;
                        _td.style.cssText += '; border-left: none; border-right: none;';
                        ifr += rs;
                        itr += rs;
                        var _planarrows = rpt.getPlanarInfo("planar_table").rows;
                        var _fc = fc, _tc = tc, rowcells = cells;
                        while (!(_td = rowcells[_fc])) {
                          if ((--_fc) < 0) break;
                        }
                        _fc = _td ? _td.dom.cellIndex : 0;
                        while (!(_td = rowcells[_tc])) {
                          if ((--_tc) < 0) break;
                        }
                        _tc = _td ? _td.dom.cellIndex : -1;
                        for ( var k = 0, klen = _planarrows.length; k < klen; k++) {
                          var planarcells = _planarrows[k].cells;
                          planarcells[_fc].style.borderLeft = 'none';
                          if (_tc !== -1) planarcells[_tc].style.borderRight = 'none';
                        }
                      } else {
                        if (i === ifr) {//清除最左边第一个宽度不为0的td的左边框
                          var rowcells = cells, c = fc, _td = null;
                          while (!(_td = rowcells[c])) {
                            if ((--c) < 0) break;
                          }
                          if (_td) {
                            //_td.dom.parentNode.firstChild.style.borderLeft 第一个td的左边也得设置,否则xgrid.js中_resetLeftBorder会重新给该td还原边框
                            _td.dom.style.borderLeft = _td.dom.parentNode.firstChild.style.borderLeft = 'none';
                            ifr += _td.rowSpan;
                          }
                        }
                        if (i === itr) {//清除最右边一个td的右边框,因为只有最右边的td才有边框
                          var rowcells = cells, c = tc, _td = null;
                          while (!(_td = rowcells[c])) {
                            if ((--c) < fc) break;
                          }
                          if (_td) {
                            _td.dom.style.borderRight = _td.dom.parentNode.lastChild.style.borderRight = 'none';
                            itr += _td.rowSpan;
                          }
                        }
                      }
                    }
                    firstcell = lastrow.firstChild;
                    while (!firstcell) { // IRPT-20266 add by chenf 2015-09-10 最后一行没有td,全被上一行合并了需要往上找
                      firstcell = (lastrow = lastrow.previousSibling).firstChild;
                    }
                    var idx = 0, cidx = null;
                    while (firstcell) { //清除最后一行的下边框
                      if ((cidx = parseInt(firstcell.getAttribute("_c"), 10)) !== idx) {
                        while(idx < cidx) {
                          var ir = rlen - 1;
                          while (ir >= 0) {
                            var _tr = _rows[ir], _cell = _tr.firstChild;
                            while (_cell) {
                              if (parseInt(_cell.getAttribute("_c"), 10) === idx) {
                                _cell.style.borderBottom = 'none';
                                idx += _cell.colSpan;
                                ir = 0;
                                break;
                              }
                              _cell = _cell.nextSibling;
                            }
                            ir--;
                          }
                        }
                      }
                      firstcell.style.borderBottom = 'none';
                      idx += firstcell.colSpan;
                      firstcell = firstcell.nextSibling;
                    }
                  }
                  var cwidths = rpt.getConfig("columnWidths"), idx = 0, clen = cwidths.length,
                    tw = rpt._rowColScrollPanel.getTotalColumnWidth(), oritw = tw;
                  while (idx < clen){
                    if (cwidths[idx] > extwLeft) {
                      rpt._setColumnWidth(idx, colWidths[idx] -= extwLeft);
                      tw -= extwLeft;
                      break;
                    }
                    idx++;
                  };
                  while (clen > idx) {
                    if (cwidths[clen] > extwRight) {
                      rpt._setColumnWidth(clen, colWidths[clen] -= extwRight);
                      tw -= extwRight;
                      break;
                    }
                    clen--;
                  }
                  rpt._table.style.width = tw + 'px';
                  rpt._offsetbordersize = oritw - tw; //IRPT-20245 add by chenf 2015-09-10 这里需要将偏移的宽度值缓存着,否则会在重新调整宽度时出现问题
                  //position为absolute时在TD里面显示不正确
                  rpt._mainDiv.style.position = rpt._table.style.position = '';
                  rpt._mainDiv.style.overflow = 'hidden';
                  //调整链接报表高度和宽度
                  /**
                   * IRPT-9816
                   * clientHeight在IE下很容易超过height,导致计算不准
                   * 改为优先使用height值
                   */
                  var stlheight = td.style.height;
                  if (stlheight.indexOf('px') > 0) {
                    rpt._resetHeight4LinkReport(parseInt(stlheight, 10));
                  } else {
                    rpt._resetHeight4LinkReport(td.clientHeight);
                  }
                  if (copypcw) {
                    copypcw["left"] = extwLeft;
                    copypcw["right"] = extwRight;
                    rpt._copypcw = copypcw;
                  } else {
                    rpt._resetWidth4LinkReport(td.clientWidth || (td.offsetWidth - _getBorderSize(td, 1)));
                  }
                  td.removeChild(shadeDiv);
                  if (isChrome) { // Chrome 浏览器链接报表高度不正确,比实际要高出非常多,需要重新渲染,引起的原因不明
                    TimeoutQueue.add(function() {
                      this._table.style.display = 'none';
                      this._table.parentNode.offsetHeight;
                      this._table.style.display = '';
                    }, { context : rpt });
                    /**
                     * IRPT-20781chrome上面,打开信息表显示不全
                     */
                    TimeoutQueue.add(function() {
                      var childDiv = this.firstChild;
                      if(childDiv){
                        var tagName = childDiv.tagName;
                        if(tagName && tagName.toLowerCase() == "div")childDiv.style.height=this.style.height;
                      }
                    }, { context : td });
                    /*setTimeout(function(){
                      rpt._table.style.display = 'none';
                      rpt._table.parentNode.offsetHeight;
                      rpt._table.style.display = '';
                    }, 100);*/
                  }
                }
              } ]
            });
        if(!_linkRelevanceReport[rptName]) {
          _linkRelevanceReport[rptName] = [];
        }
        _linkRelevanceReport[rptName].push({report: rpt, ownerRptName: WebReportHelper.getReportName(obj)});
        //找到链接表元内的链接表,隐藏链接表的边框
        //连接报表的基本信息,保存
        obj._linkedReports.push( {'frow': r, 'fcol': c, 'trow': r+td.rowSpan, 'tcol': c+td.colSpan, 'name':rptName, 'dom':td, 'report':rpt});
        rpt.setCellMoveFirst(webtask.getTaskInfo("moveRowFirst"));
      } catch(e) {
        throw new Error('装载报表异常!\r\n' + e.message);
      }
    }

function _doLoadReport(query, obj){
        if(callbackFunc){
          var triggercells = $.parseJSON(query);
          callbackFunc(gridConfig, obj, name, triggercells);
          var _webTask = obj.isQbeMode?obj : obj._webTask;
          if(_webTask && _webTask.isQbeMode()){
            //将公式表元的背景图片覆盖掉
            $(_webTask.getReport(name,"dom")).find("td[class^=s]").css("background-image","none");
          }
        }
      }

function _after_query_(queryObj, opt) {
    try {
      isRequest = false;
      WebTask.showOrHideWaitMsg(false, opt.msg);// 首先隐藏等待框
      var onfinish = opt.onfinish;
      if (onfinish) {
        queryObj.checkResult();
        var qtext = queryObj.getResponseText(), qmsg = queryObj.getMessage();
        queryObj.dispose(); // 回调前进行销毁,释放HTTP对象
        onfinish(qtext, opt.userData, qmsg);
      }
    } catch (e) {
      showError(e);
    }
    if (!isRequest) {
      if (requestQueue.length) {
        WebTask.request.apply(null, requestQueue.shift());
      }
    }
  }

function(){this._lastReadyState=this.hp.readyState;if(this.hp.readyState==4){this._clearTimeoutTimer();if(this.hp.status==undefined||this.hp.status==0||this.hp.status>12000){if(this._retry()){return;}}var onfinish=this.onfinish;if(typeof(onfinish)=="function"){onfinish(this,this.userdata);}else{eval(onfinish);}if(this.autodispose){this.dispose();}}}

function(){j._onreadystatechange();}

最近看过此主题的会员

esen_4Y3L5ADO80

esen_4ZJ8RP7VB1

esen_53UOMOENFW

caoxin1

chentao

txl

ddb

最佳答案

1、有进行什么特殊操作吗?
2、是这一个任务还是多个任务都有这个报错
3、是在任务编辑还是任务填报的时候
5个回答

只看楼主

寻找AWM 小试身手Lv3

发表于2018-9-12 10:24

只看该作者

取消 关注该作者的回复

沙发

有截图看下么

a88118115 数据小白Lv1

发表于2018-9-12 10:29

只看该作者

取消 关注该作者的回复

板凳



寻找AWM 小试身手Lv3

发表于2018-9-12 09:45

只看该作者

取消 关注该作者的回复

地板


1、有进行什么特殊操作吗?
2、是这一个任务还是多个任务都有这个报错
3、是在任务编辑还是任务填报的时候

a88118115 数据小白Lv1

发表于2018-9-12 11:24

只看该作者

取消 关注该作者的回复

5#

寻找AWM 发表于 2018-9-12 10:33
1、有进行什么特殊操作吗?
2、是这一个任务还是多个任务都有这个报错
3、是在任务编辑还是任务填报的时 ...

没有  就是载入的时候,就这一个任务

a88118115 数据小白Lv1

发表于2018-9-12 11:38

只看该作者

取消 关注该作者的回复

6#

该问题出现在嵌套固定表,任务填报加载时出现,嵌套表栏提示报错,其他任何操作都没有

登录后可回答问题,请登录注册

小时

全天响应

分钟

快速处理问题

工程师强势助力

明星产品
解决方案
联系合作

400咨询:400-0011-866

技术支持QQ:400-0011-866(工作日9:00-18:00)

产品建议邮箱yixin@esensoft.com

关注我们

扫TA学习更多干货

一对一专家交流