Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    patch for placeEmbeddedComponent

    Hi there, I had to add a patch to your placeEmbeddedComponent method to avoid an NPE. This was also happening in version 10.0 and we switched to 12.0 and same patch needed. See this line added below:
    if(_19!=null){

    if (window.isc && (isc.version.startsWith("v12.0") )){

    isc.GridRenderer.getPrototype().addProperties({

    placeEmbeddedComponent: function isc_GridRenderer_placeEmbeddedComponent(_1) {

    var _2 = _1.$289;

    if (_2 == null || (this.$252 == null || this.$253 == null) || (_2 < this.$252 || _2 > this.$253)) {
    if (_1.isDrawn()) _1.clear();
    return
    }

    if (!_1.removeOnHideField && _1.$81k && !this.grid.getField(_1.$81k)) {
    if (_1.isDrawn()) _1.clear();
    return
    }
    var _3 = _1.embeddedRecord,
    _4 = _1.embeddedPosition,
    _5 = _1.$57n,
    _6 = this.getRowTop(_2),
    _7 = (_5 != null && _5 >= 0) ? this.getColumnLeft(_5) : null,
    _8 = (_5 != null && _5 >= 0) ? this.getColumnWidth(_5) : Math.min(this.getInnerWidth(), this.$26a.sum());
    if (_7 == null) {
    if (!this.isRTL()) {
    _7 = this.getScrollLeft()
    } else {
    _7 = this.$95h(this.getScrollLeft(), true)
    }
    }
    if (_4 == this.$57l) {
    var _9 = this.getEmbeddedComponentSnapTo(_1, _3, _2, _5),
    _10 = _1.snapEdge || _9;
    var _11;
    if (this.allowRowSpanning && this.getRowSpan) {
    var _12 = this.getRowSpan(_3, _2, _5 == null ? 0 : _5);
    if (_12 == null) _12 = 1;
    _11 = 0;
    for (var i = 0; i < _12; i++) {
    _11 += this.getRowSize(_2 + i)
    }
    } else {
    _11 = this.getRowSize(_2)
    }
    var _14 = _1._percent_width,
    _15 = _1._percent_height,
    _16, _17;
    if (!_1.sizeWithExpansion) {
    var _18 = 0,
    _19 = this.grid.$917(_3);

    //7/29/19 NPE check
    if(_19!=null){
    for (var i = 0; i < _19.length; i++) {
    var _20 = _19[i];
    if (_20 == null) continue;
    var _21 = (_20.embeddedPosition == this.$57l);
    if (_21) continue;
    var _22 = _20.getVisibleHeight();
    if (_22 > _18) {
    _18 = _22
    }
    }

    }
    _11 -= _18
    }
    if (_1.snapOffsetLeft) _8 -= _1.snapOffsetLeft;
    if (isc.isA.String(_14) && _14.endsWith("%")) {
    _16 = Math.round((parseInt(_14) * _8) / 100)
    }
    if (isc.isA.String(_15) && _15.endsWith("%")) {
    _17 = Math.round((parseInt(_15) * _11) / 100)
    }
    if (_17 || _16) {
    _1.resizeTo(_16, _17, null, null, this.$1872, true)
    }
    isc.Canvas.snapToEdge([_7, _6, _8, _11], _9, _1, _10)
    } else {
    _1.moveTo(_7, _6);
    var _16, _17, _15 = _1._percent_height;
    if (isc.isA.String(_15) && _15.endsWith("%")) {
    _17 = Math.round((parseInt(_15) * this.cellHeight) / 100)
    }
    _16 = _8;
    _1.resizeTo(_16, _17, null, null, this.$1872, true)
    }
    var _23 = this.isDrawn();
    if (_23 && !_1.isDrawn()) _1.draw();
    var _24 = this.$207d,
    _25 = this.getRowHeight(_3, _2, this.$100b()),
    _26 = !this.isDirty() || _24;
    if (_26 && (_25 > this.getRowSize(_2))) {
    this.setRowHeight(_2, _25, _3);
    this.refreshRow(_2)
    }
    if (_23) {
    if (_4 != this.$57l) {
    var _27 = this.getDrawnRowHeight(_2) - _1.getVisibleHeight() - 1;
    _1.moveTo(null, this.getRowTop(_2) + _27)
    }
    if (!_1.isVisible()) {
    if (this.shouldAnimateEmbeddedComponent(_1)) {
    _1.animateShow()
    } else {
    _1.show()
    }
    }
    }
    this.updateEmbeddedComponentZIndex(_1)
    }

    })



    }

    #2
    That's for pointing this out. We've added a check to avoid the problem back to SC 10.1p, which should be in today's nightly builds.

    In the future, if you want to suggest a patch, it would be better to submit a modified version of the debug code from the modules-debug directory of your SDK, as it will have fewer differences from our source. When posting, you can also use a [CODE] tag to preserve whitespace for readability.

    Comment

    Working...
    X