PDA

View Full Version : Ext.application get namespace



Sundayextjs
3 Nov 2014, 4:38 AM
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


Ext.application(
"MyApp.Application",
{
name: "MyApp"
.........
}
)


And this is the code how i set my window title


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();

slemmon
4 Nov 2014, 4:27 PM
Hi,

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

Sundayextjs
5 Nov 2014, 1:05 AM
Hi slemmon

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

slemmon
5 Nov 2014, 1:45 PM
From the controller you can fetch a reference to the application and its name like in the following example:



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!');
}
});

Sundayextjs
6 Nov 2014, 6:00 AM
Hi selmmon, i get now.
this is my button click method event :


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 =D>.

How i can change my Unsanwered Thread to Answered?

carol.ext
6 Nov 2014, 8:26 AM
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.

Sundayextjs
7 Nov 2014, 12:55 AM
Thank carol.extjs