Thursday, November 12, 2015

Config

Ext.define('Student', {
    config : 
    {
        name : 'unnamed',
        schoolName : 'Unknown'
    },
    constructor : function(config){
        this.initConfig(config);
    }
});

var newStudent = Ext.create('Student', { name: 'XYZ', schoolName: 'ABC School' });
newStudent.getName();//output: XYZ
newStudent.getSchoolName();//output: ABC School

newStudent.setName('John');
newStudent.setSchoolName('New School');

newStudent.getName();//output: John
newStudent.getSchoolName();//output: New School

No comments:

Post a Comment