Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-5216 in a recent build.
  1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    7
    Vote Rating
    0
    HaukeG is on a distinguished road

      0  

    Default c is not a constructor message at the very first example

    c is not a constructor message at the very first example


    Hello everyone,

    I get a strange message when I try the example application at
    http://docs.sencha.com/ext-js/4-0/#/...n_architecture

    I downloaded ext-js 4.0.2a and extracted all the content to

    c:\dev\testing\extjs

    and created the directory like said in the guide

    c:\dev\testing\account_manager

    here is the content of the index.html

    Code:
    <html>
    <head>
        <title>Account Manager</title>
    
        <link rel="stylesheet" type="text/css" href="../extjs/resources/css/ext-all.css">
    
        <script type="text/javascript" src="../extjs/ext-debug.js"></script>
    
        <script type="text/javascript" src="app.js"></script>
    </head>
    <body></body>
    </html>
    and the app.js looks like this

    Code:
    Ext.application({
        name: 'AM',
    
        appFolder: 'app',
    
        launch: function() {
            Ext.create('Ext.container.Viewport', {
                layout: 'fit',
                items: [
                    {
                        xtype: 'panel',
                        title: 'Users',
                        html : 'List of users will go here'
                    }
                ]
            });
        }
    });

    As soon as I open the index.html the page remains white without content. Firebug tells me

    c is not a constructor
    this.instanciators[len...return new c ('+args.join(',')+')');

    at ext-debug.js (line 6456)


    Can somebody help me with that?

    Thanks a lot
    Hauke

  2. #2
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    do you get any 404 errors?

    stevil

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    7
    Vote Rating
    0
    HaukeG is on a distinguished road

      0  

    Default


    Hey,

    no, I checked all nodes underneath <html><head> inside firebug.
    Each node has the complete JS content.

    I am not used the syntax of javascript (I am more used to regular java),
    but what does this line mean:

    Code:
    this.instantiators[length] = new Function('c', 'a', 'return new c('+args.join(',')+')');
    Does this create a new function called "c"?
    I am a little bit confused because I am stucked at the very first example.

    Thanks for help and many greetings,
    Hauke

  4. #4
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    It creates, basically, an anonymous function that calls c(elements of array a, combined into a comma-delimited string)

    My guess is that this is a problem with Ext.Loader setup. If you use ext-all-debug.js, does this still happen? Does the problem change in any way?

    stevil

  5. #5
    Sencha User
    Join Date
    May 2011
    Posts
    92
    Vote Rating
    0
    ext-spring-mvc is on a distinguished road

      0  

    Default


    I have similar issue to instantiate my own class via "Ext.create". If I use xtype style, everything is fine.

    is it a bug?

  6. #6
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Unfortunately, I think the only way to get past this is to see where in the call stack this is, and what it's trying to create?

    stevil

  7. #7
    Sencha User
    Join Date
    Jun 2009
    Posts
    7
    Vote Rating
    0
    HaukeG is on a distinguished road

      0  

    Default


    Hi,

    now I tried it with ext.js.

    Still same error but on line 15. But that is the reason because the whole file contains only one row. The whole ext.js has several lines of comments and only line of code (a very long line) :-)

    How can that happen? This is the very first example and that isn't working? Should I try it with an older version of ext js 4?

    Best regads,
    Hauke

  8. #8
    Sencha User
    Join Date
    Jun 2009
    Posts
    7
    Vote Rating
    0
    HaukeG is on a distinguished road

      0  

    Default


    And again,

    I tried an older version of ext-js 4 and the error is gone, but still nothing happens (complete white page). Then I deleted the whole directory of ext-js again and copied the content of 4.0.2a again, and the error is still gone.
    So I have no idea why this error is not there anymore.
    Same result in IE and Firefox.

    Thanks,
    Hauke

  9. #9
    Sencha User
    Join Date
    May 2011
    Posts
    92
    Vote Rating
    0
    ext-spring-mvc is on a distinguished road

      0  

    Default


    Quote Originally Posted by stevil View Post
    Unfortunately, I think the only way to get past this is to see where in the call stack this is, and what it's trying to create?

    stevil
    via call stack, it is trying to invoke constructor method of my self-defined class which extends Ext.tree.Panel or Ext.panel.Panel. which I don't understand is why there is no constructor? I didn't override constructor in my self-defined class so that I expected Extjs would call the parent's constructor instead.

  10. #10
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    ok - so if it's trying to construct your extension, and the constructor doesn't exist, then that implies that Ext.define didn't work. The most likely reason (other than straight JS error), would be that the class you're extending is not loaded.

    so, at the point of failure, can you go to the console and enter Ext.tree.Panel and then Ext.panel.Panel, and see if they're defined?

    If they are, I'd look to see if you're having some sort of silent failure in Ext.define.

    @hauke - I think you purged the elves from your configuration


    stevil