openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

ColumnWidthController method sanityCheck missing 'name' property when not using xConfig

Open TawillAvi opened this issue 9 months ago • 2 comments

Hi,

I implemented sap.m.p13n.Engine on sap.m.Table, registering ColumnWidthController. The delta check for this controller seems to be wrong cause the applyState method of the engine working only for the first time. debbuging it, I have got to the conclusion the 'delta' is not being proccess as it should. on the SelectionController ( which is the base of ColumnWidthController ) in the method 'getPropertySetterChanges', it's trying to find the existing component by comparing 'name' property, since the 'sanityCheck' of ColumnWidthController returns 'name' property only if 'this._bExposeXConfig' is true, the delta check is wrong. My suggestion is to add to sanityCheck return the property 'name = sKey' in addition to the key and value.

ColumnWidthController.prototype.sanityCheck = function (oState) {
        var aColumnWidth = [];
        if (this._bExposeXConfig) {
            if (oState && oState.hasOwnProperty("aggregations") && oState.aggregations.hasOwnProperty("columns")) {
                Object.keys(oState.aggregations.columns).forEach(function (sItem) {
                    var oColumnWidth = {
                        name: sItem,
                        width: oState.aggregations.columns[sItem].width
                    };
                    aColumnWidth.push(oColumnWidth);
                });
            }
        } else {
            Object.keys(oState).map((sKey) => {
                aColumnWidth.push({
                   key: sKey, name: sKey, width: oState[sKey]
                });
            });
        }
        return aColumnWidth;
    };

BR, Avi

TawillAvi avatar Mar 05 '25 08:03 TawillAvi

Hi @TawillAvi,

thanks for your pre-analysis. Could you please provide a minimal sample for us to reproduce the issue?

DonkeyCo avatar Mar 05 '25 14:03 DonkeyCo

Hi @DonkeyCo, Thanks for the fast respones please see the attached example, if you set a break point on SelectionController line 628, you will the comparation returns wrong values.

widthIssue.zip

TawillAvi avatar Mar 05 '25 21:03 TawillAvi

Hi any new about this one?

TawillAvi avatar Sep 28 '25 08:09 TawillAvi

Hi @TawillAvi,

sorry for the rather late reply. A fix is currently in review, the issue state will be updated, once the fix has been merged.

DonkeyCo avatar Sep 29 '25 07:09 DonkeyCo

Thank you!

TawillAvi avatar Sep 29 '25 10:09 TawillAvi