ExtJS Object oriented programming
Below Example to Understand EXTJS classes
Parent Class calc
Ext.define('calc', { //Define Key word to create Class in ExtJS x:0, y:0, constructor: function (config) { Ext.apply(this, config); }, getSum: function () { return this.x + this.y; }, getMultiplication: function () { return this.x * this.y; }, getDivision: function() { return this.x / this.y; } });
Child Class Add extends Parent calc
Ext.define('Add', { extend: 'calc', add: function() { return this.getSum(); } });
Instance Created for class Add
var sum = Ext.create('Add', {x:10, y:15}); Ext.Msg.alert('Addition', sum.add());
Pictorial representation of Class and objects
|
No comments:
Post a Comment