PDA

View Full Version : Where in the MVC app structure does ExtJS default overrides go?



abcdef
18 Aug 2011, 4:30 PM
I'd like to change some defaults for a component say - panel. Where do these overrides ideally go, and how to implement them?

raz0r1
18 Aug 2011, 10:23 PM
Im not 100% sure but I do it like this:



// requirements.js
Ext.require('Ext.panel.Panel', function() {
Ext.override('Ext.panel.Panel', {
[...things to override...]
});
});


but maybe someone has a better solution?

skirtle
21 Aug 2011, 10:43 PM
You really shouldn't be changing the defaults for the core ExtJS components. The only circumstance where I would use Ext.override() to modify a class in the Ext namespace is to apply a bug fix.

abcdef
21 Aug 2011, 11:35 PM
You really shouldn't be changing the defaults for the core ExtJS components. The only circumstance where I would use Ext.override() to modify a class in the Ext namespace is to apply a bug fix.

I agree. I was just looking to have some defaults apply to all my panels. Since then, I extended a panel out to my own panel, and I am using its xtype wherever necessary. But I have been using it almost everywhere, and since most things w/o an explicit xtype get interpreted as a panel, I was looking to override the defaults on all panels.

But I think i'll stick with using a custom xtype wherever necessary.

Thanks!

guykoumba
29 Aug 2011, 3:17 AM
Hello,
I also want to change the default language for my application in an MVC architecture.

skirtle
29 Aug 2011, 3:22 AM
I also want to change the default language for my application in an MVC architecture.

Localization in the MVC is being discussed in this thread but so far it doesn't seem to have been solved:

http://www.sencha.com/forum/showthread.php?144882

ostghost
10 Oct 2012, 12:58 PM
Well, there are some situations that at least from my point of view requires override. Just found this thread when looking for solution where to place following snippet to keep best practicies.



Ext.define('ET.panel.Tool', {
override:'Ext.panel.Tool',
width:26,
height:26
});


Standard height is 15px. Design team wants to have tools higher and even if following variables



$panel-header-icon-width: 26px !default;
$panel-header-icon-height: 26px !default;

$tool-size: 26px !default;


were set in custom theme, Ext is still setting inline style for x-tool img container based on calculation that counts with default 15px.

No way to solve this without override. Am I right? Ext. 4.1.1 commercial.