Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Bug in ToolStripGroup / RibbonGroup removeControl()

$
0
0
SmartClient Version v9.1p_2014-07-20/Enterprise Deployment (2014-07-20)

Bowser: Chrome & Firefox

In a ribbon bar I have a group with 4 buttons on 2 rows by 2 columns.
Than I call ribonGroup.removeControl(control) which is supposed to remove one control from the group.

Instead it removes all the controls from the column where the removed control is.

Doing some debugging, led me to the following code in ISC_Foundation.js:

Code:

  removeControl : function (control) {
        control = isc.isAn.Object(control) ? control : this.getMember(control);
        if (!control) return null;

        var column = this.getControlColumn(control);

        if (column) {
            column.removeMember(control);
            this.controls.remove(control);
            if (column.members.length <= 1) {
                // if the column is now empty, destroy it
                column.hide();
                this.body.removeMember(column);
                column.markForDestroy();
                column = null;
            }
        }

        if (this.body.members.length == 0 && this.autoHideOnLastRemove) {
            // hide ourselves
            this.hide();
        }
    },

The condition if (column.members.length <= 1) is triggered when I remove the control and this forces the entire column to be removed, because I only have 2 members in that column.

Changing this condition to if (column.members.length <= 0) resolves the issue.

This happens in the "debug" modules as well as in the "release" modules. I can use my own patched version of ISC_Foundation.js, but I prefer using the official release in order to avoid maintenance conflicts in the future.

Viewing all articles
Browse latest Browse all 4756

Trending Articles