Помогите с наследованием
Есть базовый класс.
Ext.ns('Application'); Application.Dt_area = Ext.extend(Ext.Toolbar, { id: 'dt', height: 27, visibleEdt:true, initComponent:function() { Ext.apply(this, { items: [{ xtype: 'button', text: 'Показать', scope:this, handler: function(){this.onShowClick()} }] }) Application.Dt_area.superclass.initComponent.apply(this, arguments); } ,onRender:function() { Application.Dt_area.superclass.onRender.apply(this, arguments); /*for(var i=0;i<arguments.length;i++) { alert("arguments["+i+"] = "+arguments[i]) }*/ } // eo function onRender }); Возникла необходимость, добавить несколько кнопок, и изменить текст кнопки у базового класса Соответственно создаю наследника, но как добавить еще кнопку, и изменить текст кнопки базового класса у меня не получается. Application.Dt_area_ = Ext.extend(Application.Dt_area, { id: 'dt', height: 27, visibleEdt:true, initComponent:function() { Ext.apply(this, { items: [{ xtype: 'button', text: 'Показать все', scope:this, handler: function(){this.onShowClick()} }] }) Application.Dt_area_.superclass.initComponent.apply(this, arguments); } }); Заранее благодарен |
Метод add после вызова initComponent родительского класса.
|
Вот так?
Application.Dt_area_ = Ext.extend(Application.Dt_area, { id: 'dt', height: 27, visibleEdt:true, scope:this, initComponent:function() { Ext.apply(this, { items: [{ xtype: 'button', id:'exc1', icon: 'img/excel.png', align: 'right', handler: function(){ this.onExpExcel(); } }] }) this.items.add({ xtype: 'button', id:'exc1', icon: 'img/excel.png', align: 'right', scope:this, handler: function(){ this.onExpExcel(); } }); Application.Dt_area_.superclass.initComponent.apply(this, arguments); } }); Тоже не работает(( |
В вашей вложенности разобраться нереально, поэтому не знаю точно в чём проблема, но по крайней мере
Цитата:
|
Все спасибо разобрался.
Может кому поможет Application.Dt_area_ = Ext.extend(Application.Dt_area, { id: 'dt', height: 27, visibleEdt:true, scope:this, initComponent:function() { this.add({ xtype: 'button', id:'exc1', icon: 'img/excel.png', align: 'right', scope:this, handler: function(){ this.onExpExcel(); } }); Application.Dt_area_.superclass.initComponent.apply(this, arguments); } }); |
Часовой пояс GMT +3, время: 04:59. |