-
10 Oct 2012 5:01 PM #1
Unanswered: new to Sencha, need a kick to start started - Problem with class creation
Unanswered: new to Sencha, need a kick to start started - Problem with class creation
hi,
I have created following class for Sencha, but it doesn't show the alert message.
Can someone tell me whats wrong with the code?
Also 1. do i need tp copy Person class under a separate file under folder structure My\sample ??
2. if there is any error how can I check that, I am using trial version and google chrome.
comments and suggestion are appropriated, thank you...
here is the code below.
Ext.application({
name: 'HelloExt',
launch: function(){
Ext.define('My.sample.Person',{
name: 'John';
constructor: function (name){
if (name){
this.name = name;
}
}
eat: function(foodtype){
alert(this.name + ' is eating ' + foodtype );
}
});
var k = Ext.create('My.sample.Person', 'JJ');
k.eat('fishhh');
}
});
-
10 Oct 2012 5:32 PM #2
If you just need to check a class, you can put it directly in your code as you did with your example. However, it is often a class is used for more than one place in your code, so you should put it in a separate file. You should look at this manual to see more information about naming classes, where to store them, etc : http://docs.sencha.com/ext-js/4-1/#!/guide/class_system1. do i need tp copy Person class under a separate file under folder structure My\sample ??
You should use Tools\Developer tools which is included in Chrome.2. if there is any error how can I check that, I am using trial version and google chrome.
Below are some errors in your code:
P/S: You should put your code by using CODE tag, then you will have more opportunity of getting support from community.Code:Ext.application({ name: 'HelloExt', launch: function(){ Ext.define('My.sample.Person',{ name: 'John', // ; <- comma instead of semicolon constructor: function (name){ if (name){ this.name = name; } }, // missing comma eat: function(foodtype){ alert(this.name + ' is eating ' + foodtype ); } }); var k = Ext.create('My.sample.Person', 'JJ'); k.eat('fishhh'); } });
-
12 Oct 2012 2:46 PM #3
thanks....
thanks....
its working fine now,
is there any way where I can check the error log ??
there should be some place where I can check the log and come to know that i have added semi colon inplace of comma.
<code>
Ext.application();
</code>
-
12 Oct 2012 2:47 PM #4
-
12 Oct 2012 3:38 PM #5
Just use Tools\Deverloper tools that comes with Chrome browser.


Reply With Quote