Announcement

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

    Occasional TypeError in ListGrid._remapEmbeddedComponents

    Hi,

    Just to report, we occasionally get an error such as

    com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'length' of undefined

    from our quite complex app. We've traced it down to ListGrid.js:​_remapEmbeddedComponents function:

    Code:
     if (this._shouldRetainEmbeddedComponents == false ||
                        (this.showRecordComponents && this.recordComponentPoolingMode == "data") ||
                        
                        (component.isExpansionComponent)
                ) {
                    if (currentRecord != null) {
                        // This is essentially a dup of code form _removeEmbeddedComponent:
                        var ids = currentRecord[this._$embeddedComponentsPrefix + this.ID];
                        if (ids != null && ids.length > 0) {
                            ids.remove(component.getID());
                        }
                        if (ids.length == 0) {
                            currentRecord[this._$embeddedComponentsPrefix + this.ID] = null;
                        }
                        // remove the 'expanded' marker from the row
                        if (component.isExpansionComponent) {
                            this._setExpanded(currentRecord, false);
                            this._setExpansionComponent(currentRecord, false);
                        }
                    }
                    // remove the embeddedComponent from the grid body and rehash the properties
                    // that track expandedRecords
                    removeThese.add(component);
                }
    These are lines 32881 - 32904 in ListGrid.js with smartgwt 5.0p lgpl latest nightly (2017-01-03). There actually seems to be a null check for "ids" first, but the second line ("ids.length == 0") fails without it.

    #2
    We've made a change to address this in 5.0 - you can test it out in builds dated January 9 and later.

    However, note that this bug was fixed long ago in all later branches, including 5.1, the latest minor version in the 5.x series. You should consider upgrading to 5.1 because bugs with large or complex fixes may only be addressed in the latest minor versions of each of the older branches - eg, 4.1 and 5.1, but not 4.0 or 5.0.

    Comment

    Working...
    X