Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Adding custom configs in class override throws error

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    84
    Vote Rating
    2
      2  

    Default Adding custom configs in class override throws error

    REQUIRED INFORMATION
    Ext version tested:
    • Sencha Touch 2.0.0 commercial
    Browser versions tested against:
    • Chrome 19.0.1061.1 dev
    DOCTYPE tested against:
    • html
    Description:
    • When overriding a class, if you define a config section with new attributes, an error is thrown.
    Steps to reproduce the problem:
    • Override a class
    • Add a custom config
    • Add a constructor that calls parent constructor & initconfig
    The result that was expected:
    • Override class with an additional config, with the appropriate setters & getters
    The result that occurs instead:
    • Error thrown when trying to load - Uncaught TypeError: Cannot read property 'apply' of undefined
    Test Case:
    Code:
    Ext.define("ExamplePanel", {
        override: "Ext.Panel",
    
        config: {
            test: 'a config'
        },
    
        constructor: function(config) {
            this.initConfig(config);
            this.callParent(arguments);
        }
    });


  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    Thanks for the report.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    84
    Vote Rating
    2
      0  

    Default

    Can you confirm that this is a bug? Should one be able to define custom config items in an override class?

    Thanks.

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    I opened a bug ticket already. As a developer, I would expect to be able to.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    19
      0  

    Default

    I feel strongly this is blurring the line between an override and a custom class too far, but we'll take a look at it.

    Sencha Inc

    Jamie Avins

    @jamieavins

  6. #6
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    153
    Vote Rating
    23
      0  

    Default

    Quote Originally Posted by Jamie Avins View Post
    I feel strongly this is blurring the line between an override and a custom class too far, but we'll take a look at it.
    Here's an example of where I'd like to use this.

    I'd like to add a tableName config to the association class so that my SQLite proxy can use it to write the associated data. I can't see a way to extend association and then have the Model use that class when it creates the associations.

    Note: tried addConfig too and it didn't define the set and get methods either.

    What I'll probably end up doing is overriding the Association and in the constructor stick the tableName into a property that will be retrieved.

    Thanks
    Bob

  7. #7
    Sencha Premium User suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    715
    Vote Rating
    236
      0  

    Default

    +1 I've hit this issue trying to override and add new functionality to Container.
    I don't want to extend as I want the functionality to be available in both container and Panel.

    Any update on when a fix will be available?

  8. #8
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    27
    Vote Rating
    3
      0  

    Default

    This would be convenient for something like adding the RowExpander plugin to the grid... Starting out, I assumed I could do this.

    Since I can't, not sure how to do something so simple like use a plugin that isn't built-in to Architect

  9. #9
    Sencha Premium Member zmagyar's Avatar
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    94
    Vote Rating
    2
      0  

    Default

    I just run into this problem as well. Is there any known workaround?

  10. #10
    Sencha Premium User suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    715
    Vote Rating
    236
      0  

    Default

    Indications are the bug fix may be released in Touch 2.1

    For now I have extended Sencha classes instead of overriding but I lose the benefit of other subclasses inheriting the functionality.
    You could look at using a mixin to achieve multiple inheirtance

Page 1 of 2 12 LastLast

Posting Permissions

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