Results 1 to 10 of 10

Thread: Override Ext

  1. #1
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    769
    Answers
    38
    Vote Rating
    77
      0  

    Default Override Ext

    Hi, is possible override Ext singleton ? It works well until you run sencha app build production -> you get following error:

    [ERR] C2016: Override target not found -- Y:\app\overrides\Ext.js:2:10

    Thanks in advance for any hint.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    504
      0  

    Default

    You can override an instance of the singleton, but not the singleton itself. It is just a object with properties.

    Here is a SO from Alex with an example:
    http://stackoverflow.com/questions/1...on-constructor

  3. #3
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    769
    Answers
    38
    Vote Rating
    77
      0  

    Default

    What I do is change applyIf function in Ext singleton:
    PHP Code:
    Ext.define('App.overrides.Ext', {
        
    override'Ext',
        
    applyIf: function (objectconfigrecursive) {
            var 
    property;
            if (object) {
                for (
    property in config) {
                    if (
    object[property] === undefined) {
                        
    object[property] = config[property];
                    } else if (
    Ext.isObject(object[property]) && recursive {                    
                        
    Ext.applyIf(object[property], config[property], recursive);
                    }
                }
            }
            return 
    object;
        }
    }); 

  4. #4
    Sencha User
    Join Date
    Mar 2016
    Posts
    44
    Answers
    2
    Vote Rating
    0
      0  

    Default

    Hi @Zdeno. Did you resolve that issue ?

  5. #5
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    769
    Answers
    38
    Vote Rating
    77
      0  

    Default

    Quote Originally Posted by NoOnesThere89 View Post
    Hi @Zdeno. Did you resolve that issue ?
    Not sure if in Ext 5 but currently I use my own utils singleton with helpers like this. Basically you can simply override singleton when ext is ready with
    PHP Code:
    Ext.myCustomFunction= function() { return true;} 
    and then simply call
    HTML Code:
    Ext.myCustomFunction()
    . However I recommend you use own namespace like App.helpers, App.utils etc where you keep modifications like this.

  6. #6
    Sencha User
    Join Date
    Mar 2016
    Posts
    44
    Answers
    2
    Vote Rating
    0
      0  

    Default

    I asked becouse I do the following things:

    Code:
    Ext.define('Ext.theme.MyApp.d3.hierarchy.TreeMap', {
        override      : 'Ext.d3.hierarchy.TreeMap',
        onNodeSelect: function(){
           this.callSuper(arguments);
        }
    });
    And see the following message during production build:

    [ERR] C2016: Override target not found --


  7. #7
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    769
    Answers
    38
    Vote Rating
    77
      0  

    Default

    I guess you are using ExtJS 6.2 with D3 charts but this is ExtJS 5 forum Anyway did you put your override inside d3 package? There should be folder (which was generated by Sencha Cmd) {workspace}\packages\local\{package}\overrides or where did you put this override?

  8. #8
    Sencha User
    Join Date
    Mar 2016
    Posts
    44
    Answers
    2
    Vote Rating
    0
      0  

    Default

    Thank you for helping me. You are right its for 6.5 Extjs. The file located in:

    \WebSource\packages\local\myapp-gray-theme\overrides\d3\hierarchy\TreeMap.js

  9. #9
    Sencha User
    Join Date
    Mar 2016
    Posts
    44
    Answers
    2
    Vote Rating
    0
      0  

    Default

    Should mention that during
    HTML Code:
    sencha app build -c -dev  MyApp
    I didn't see errors

  10. #10
    Sencha User
    Join Date
    Mar 2016
    Posts
    44
    Answers
    2
    Vote Rating
    0
      0  

    Default

    added in requires d3 for file package.json in my theme and it helped

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •