I try to create a few objects like this:
Object_level_1 = Ext.extend ( Ext.util.Observable, {
PropA: null,
ProbB: null,
initComponent: function () {
Object_level_1.superclass.initComponent.call ();
},
setValue: function ( name, value ) { // it will come as 'PropA', 45
if ( this.hasOwnProperty ( name ) ) { // ' fixed base on dtan answer
// here is a problem 1
// how I can access correct property and set it up
// problem 2
// How I set up property value of right property by having variable name
this.fireEvent ( 'Update_on_level_1' );
}
}
}
Object_level_2 = Ext.extend ( Object_level_1, {
PropC: null,
ProbD: null,
initComponent: function () {
Object_level_1.superclass.initComponent.call ();
},
setValue: function ( name, value ) { // it will come as 'PropA', 45 or 'PropC', 100
Object_level_2.superclass.setValue ( name, value );
if ( this.hasOwnProperty ( name ) ) { // ' fixed base on dtan answer
// here is a problem 1 again
// how I can access correct property and set it up
// problem 2 again
// How I set up property value of right property by having variable name
this.fireEvent ( 'Update_on_level_2' );
}
}
}
Does someone know the solution?