1. #1
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    226
    Vote Rating
    0
    Answers
    4
    abcdef is on a distinguished road

      0  

    Default Answered: Where in the MVC app structure does ExtJS default overrides go?

    Answered: Where in the MVC app structure does ExtJS default overrides go?


    I'd like to change some defaults for a component say - panel. Where do these overrides ideally go, and how to implement them?

  2. Im not 100% sure but I do it like this:

    Code:
    // requirements.js
    Ext.require('Ext.panel.Panel', function() {
    Ext.override('Ext.panel.Panel', {
    [...things to override...]
    });
    });
    but maybe someone has a better solution?

  3. #2
    Sencha User
    Join Date
    Sep 2009
    Posts
    84
    Vote Rating
    -1
    Answers
    8
    raz0r1 is an unknown quantity at this point

      0  

    Default


    Im not 100% sure but I do it like this:

    Code:
    // requirements.js
    Ext.require('Ext.panel.Panel', function() {
    Ext.override('Ext.panel.Panel', {
    [...things to override...]
    });
    });
    but maybe someone has a better solution?

  4. #3
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,101
    Vote Rating
    120
    Answers
    457
    skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold

      0  

    Default


    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.

  5. #4
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    226
    Vote Rating
    0
    Answers
    4
    abcdef is on a distinguished road

      0  

    Default


    Quote Originally Posted by skirtle View Post
    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!

  6. #5
    Sencha User
    Join Date
    May 2010
    Location
    Atakpamé, TOGO
    Posts
    1
    Vote Rating
    0
    guykoumba is on a distinguished road

      0  

    Default What about localisation

    What about localisation


    Hello,
    I also want to change the default language for my application in an MVC architecture.

  7. #6
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,101
    Vote Rating
    120
    Answers
    457
    skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold

      0  

    Default


    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

  8. #7
    Sencha Premium Member
    Join Date
    Jun 2007
    Location
    Ostrava, Czech Republic
    Posts
    43
    Vote Rating
    1
    ostghost is on a distinguished road

      0  

    Default


    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.

    Code:
    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

    Code:
    $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.