1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    116
    Vote Rating
    16
    Answers
    2
    Notepad123 will become famous soon enough

      0  

    Default Answered: Help with requiers doesn't work - What am I doing wrong?

    Answered: Help with requiers doesn't work - What am I doing wrong?


    Following code doesn't work since in MyPanel it can't figure out {xtype : 'MyTitlebar'} although I have used requiers : ['MyApp.MyTitlebar'],

    app.js
    Code:
    Ext.setup({ 
     
      onReady        : function() {
       
        var mypanel = Ext.create('MyApp.MyPanel'); //Uncaught TypeError: object is not a function 
              
        Ext.create('Ext.Panel', {
          fullscreen : true,
          layout     : 'auto',
          items      : [mypanel]
        });
       
      }
     
    });
    MyApp/MyPanel.js
    Code:
    Ext.define('MyApp.MyPanel',{
      extend     : 'Ext.Panel',
      requiers   : ['MyApp.MyTitlebar'],  //Comma seperated list
      config     : {
        items    : [
          {xtype : 'MyTitlebar'},  
          {html  : 'Some text' }
        ]
      }
    });
    MyApp/MyTitlebar.js
    Code:
    Ext.define('MyApp.MyTitlebar',{
      extend   : 'Ext.TitleBar',
      xtype    : 'MyTitlebar',
      config   : {
        title  : 'My Titlebar'
      }
    });

  2. You have a typo. You use "requiers" instead of "requires".

  3. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    63
    Vote Rating
    11
    Answers
    7
    bumpy will become famous soon enough

      0  

    Default


    You have a typo. You use "requiers" instead of "requires".

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    116
    Vote Rating
    16
    Answers
    2
    Notepad123 will become famous soon enough

      0  

    Default


    Thank you so much for your help.
    I find debuging JS extremly dificult.
    It seems that I always get one of two generic error messages, it never tells me in what line something is wrong. Since requires isn't a keyword it doesn't get highlighted, or it never tells me where I missed to put comma and so on. Is there something more that I should know about debugging because currently I just get:

    SOMETHING IS WRONG WITH YOUR APPLICATION BUT WE HAVE NO IDEA WHAT OR WHERE.

    And then i need to go through all parts of my code bit by bit manually.

  5. #4
    Sencha User
    Join Date
    Aug 2012
    Posts
    63
    Vote Rating
    11
    Answers
    7
    bumpy will become famous soon enough

      0  

    Default


    You're welcome.

    I'ts true that debugging JS can sometimes be more difficult than debugging compiled languages like Java or C#. Chrome dev tools and similar tools do help a lot and most of the time they do show the exact line where the error originates.

    Spelling mistakes and typos are a bit more problematic and require special attention. As you become more experienced in JS and the framework you use specifically, it'll become much easier for you to understand what could be the problem and spot your mistakes. The fact is that you understood exactly what was your problem, it was just a matter of double checking your spelling.

  6. #5
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    409
    Vote Rating
    18
    Answers
    18
    digeridoopoo will become famous soon enough

      0  

    Default App Inspector

    App Inspector


    Why don't you download the Sencha App Inspector for Google Chrome.....that might have given you some more clues too

    :-)

  7. #6
    Sencha User
    Join Date
    Jan 2012
    Posts
    116
    Vote Rating
    16
    Answers
    2
    Notepad123 will become famous soon enough

      0  

    Default


    Thanks it looks nice.
    I was hoping that some tools might exists somewhere because otherwise it is hell to use JavaScript and Sencha.
    Good thing such important tools are clearly communicated to people starting to use the framework.

Thread Participants: 2