Results 1 to 7 of 7

Thread: Ext.application get namespace

  1. #1

    Default Answered: Ext.application get namespace

    Hello i very sorry for my question, i think that it's a beginners question but i would to set my application namespace in my window title.

    My application.js
    Code:
    Ext.application(
       "MyApp.Application",
       {
           name: "MyApp"
           .........
       }
    )
    And this is the code how i set my window title
    Code:
    var win = Ext.create('MyApp.view.About');
                    win.setTitle('About to' <<now i would to get myapp namespace. i use MyApp.getApplication().getName() but i receive errors>>);
                    win.show();

  2. From the controller you can fetch a reference to the application and its name like in the following example:

    Code:
    Ext.define('Fiddle.controller.Main', {
        extend: 'Ext.app.Controller',
        
        init: function () {
            console.log(this.application.name);
        }
    });
    
    
    
    
    
    
    Ext.application({
        name : 'Fiddle',
        
        controllers: ['Main'],
    
    
        launch : function() {
            //Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
        }
    });

  3. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    Hi,

    Are you creating the Ext.window.Window within the scope of a controller?

  4. #3

    Default

    Hi slemmon

    yes i create my window within the scope of my controller.

  5. #4
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    From the controller you can fetch a reference to the application and its name like in the following example:

    Code:
    Ext.define('Fiddle.controller.Main', {
        extend: 'Ext.app.Controller',
        
        init: function () {
            console.log(this.application.name);
        }
    });
    
    
    
    
    
    
    Ext.application({
        name : 'Fiddle',
        
        controllers: ['Main'],
    
    
        launch : function() {
            //Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
        }
    });

  6. #5

    Default

    Hi selmmon, i get now.
    this is my button click method event :
    Code:
      onButtonClickApropos: function(button, e, options) {
      var win = Ext.widget('apropos'),
            appName = this.application.name;
            win.setTitle('A propos de'+' '+appName);
            win.show();
      },
    and in my Window title i get A Propos de MyAppName

    Thank .

    How i can change my Unsanwered Thread to Answered?

  7. #6
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    707
    Answers
    25

    Default

    Sticky thread in this forum Answered/Unanswered says

    There is a link at the top-right of each post to mark that post as the best answer.

  8. #7

    Default

    Thank carol.extjs

Posting Permissions

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