Hi all,
Well, after testing some cases, I'm really not liking this new behavior in Ext.override('...', {...});, maybe I'm still missing something,
For example, in 4.1, I have a few overrides like this one:
but when Ext.layout.Context.runLayout runs, it calls layout.calculate(ownerContext), and, for a fit layout, the original calculate function is called instead of the override and thus it's giving me:but when Ext.layout.Context.runLayout runs, it calls layout.calculate(ownerContext), and, for a fit layout, the original calculate function is called instead of the override and thus it's giving me
Mitchell Simoens @LikelyMitch
Modus Create, Senior Frontend Engineer
________________
Need any sort of Ext JS help? Modus Create is here to help!
Last edited by mitchellsimoens; 3 Nov 2011 at 11:09 AM. Reason: Let me fix that missing ']' for you :D
Don Griffin
"Use the source, Luke!"
Yep, I know that workaround should not be needed, but I'm doing those overrides so I can test the 4.1.
I've used a few overrides for fixing problems that I got in 3.x, then in 4.0 and for sure, somewhere in the future I'd need some overrides to fix bugs until they are fixed in new releases (hopefully we'll be getting access to the 4.1 svn/git branch soon), so I need to find a reliable way to override some methods in ExtJS >= 4.1.
I've tried modifying directly ext-all-dev and they let me use my app with a few quirks here and there, but no errors, and I'm very pleased with the performance improvements, but obviously this method shouldn't be used....
I've tried doing the old school "Ext.layout.container.Fit.prototype.calculate = function (ownerContext) { ... };" for all my overrides, and although no error is raised, the app is not rendering as it is if I do the changes directly in ext-all-dev.... gotta investigate more why.
So, that's why I'm raising this issue about Ext.override(''..", {..}); these kind of overrides worked on 3.x and 4.0, so, I'm trying to find a way to be able to override core methods reliably.
Yup, in my tests, the override doesn't seems to be called, so that's the part I'm not liking (as I'm guessing more changes where done to that behavior, but maybe I'm wrong - I've not checked the core code to verify it -), I've no problem with the callParent change...
My override isn't getting called (tried some console.log) when the runLayout calls layout.calculate(....) as it calls the overridden original method...
You could try (in 4.1 only):
With appropriate namespaces and pathing of course.With appropriate namespaces and pathing of course.PHP Code:
Ext.define('My.patch.Fit', {
override: 'Ext.layout.container.Fit',
calculate: function () {
...
}
});
//--- in your app:
{
layout: 'fit',
requires: 'My.patch.Fit'
}
This is a big part of why Ext.define/override was added in 4.1: to help manage overrides and when they are included in a build and when they can be (safely) applied to their target class.
Hope this helps!
Don Griffin
"Use the source, Luke!"