PDA

View Full Version : Doubled code run?



norbul
6 Oct 2012, 12:11 PM
I have EXT JS class as bellow, after run i got 2 alerts messages. And the question is WHY?



Ext.define('User', { extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'age', type: 'int', convert: null},
{name: 'phone', type: 'string'},
{name: 'alive', type: 'boolean', defaultValue: true, convert: null}
],


changeName: function() {
var oldName = this.get('name'),
newName = oldName + " The Barbarian";


this.set('name', newName);
}
});




var user = Ext.create('User', {
name : 'Conan',
age : 24,
phone: '555-555-5555'
});


user.changeName();




alert( user.get('name') ); //returns "Conan The Barbarian"

scottmartin
6 Oct 2012, 1:32 PM
I only see one alert ....
http://jsfiddle.net/4hJUW/

norbul
10 Oct 2012, 10:45 AM
.. you have right. This happen only on ext-dev 4.1 version, on ext-all is OK.