Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJS-17103
in
5.1.2.
-
Sencha Premium Member
Disabled button enables when parent container got enabled
Ext version tested:
Description:
- Container with button both set 'disabled: true' explicitly. When parent container is set enabled button also looks enabled.
Steps to reproduce the problem:
The result that was expected:
- Button to remain visually disabled
The result that occurs instead:
I know there are similar threads:
http://www.sencha.com/forum/showthread.php?295910 (says fixed)
http://www.sencha.com/forum/showthread.php?296873 (dup)
But there were opposite problem: button with initial enabled state remained disabled when parent container was set enabled.
Problem code:
Ext.container.Container:
Code:
/**
* @override
* Disables all child input fields and buttons.
*/
disable: function(silent, /* private */fromParent) {
var me = this,
wasDisabled = me.disabled,
itemsToDisable, len, i;
me.callParent([silent, fromParent]);
if (!fromParent && !me.preventChildDisable && !wasDisabled) {
itemsToDisable = me.getChildItemsToDisable();
len = itemsToDisable.length;
for (i = 0; i < len; i++) {
itemsToDisable[i].disable(silent, true); // button doesn't respect second argument
}
}
return me;
},
/**
* @override
* Enables all child input fields and buttons.
*/
enable: function(silent, /* private */fromParent) {
var me = this,
wasDisabled = me.disabled,
itemsToDisable, len, i;
me.callParent([silent, fromParent]);
if (wasDisabled) {
itemsToDisable = me.getChildItemsToDisable();
len = itemsToDisable.length;
for (i = 0; i < len; i++) {
itemsToDisable[i].enable(silent, true); // button doesn't respect second argument
}
}
return me;
},
Last edited by Alexey.Solonets; 18 Mar 2015 at 6:08 AM.
Reason: title changed
-
Sencha Premium Member
Workaround (may be not perfect)
Code:
Ext.define('Ext.bf.button.Button', {
override: 'Ext.button.Button',
enable: function (silent, fromParent) {
fromParent = !!fromParent;
if (fromParent == this.disabledFromParent) {
this.callParent(arguments);
}
else if (fromParent) {
this.disabledFromParent = false;
}
},
disable: function (silent, fromParent) {
fromParent = !!fromParent;
if (!this.disabled) {
this.disabledFromParent = fromParent;
this.callParent(arguments);
}
}
});
-
Thanks for the report and workaround! I have opened a bug in our bug tracker.
-
Sencha Premium Member
Another workaround that is better for me so far
Code:
Ext.define('Ext.bf.button.Button', {
override: 'Ext.button.Button',
enable: function (silent, fromParent) {
if (!fromParent) {
this.callParent(arguments);
}
},
disable: function (silent, fromParent) {
if (!fromParent) {
this.callParent(arguments);
}
}
});
-
Opened Sencha ticket 22400 to get this resolved in a timely fashion.
-
That issue have not been looked at by Sencha since 2015-03-27. Why the override is just not integrated to the framework?
-
Ext JS Premium Member
I've got the same problem.
My version is 5.1.1.451.
Any solution from Sencha support???