PDA

View Full Version : Dynamically change config to all future instances of a component defined by me



American horizon
22 Jan 2018, 4:40 AM
hi.
i've this component




Ext.define('CS.view.ImportGridRecordsButton' ,{
extend: 'Ext.button.Button',
alias: 'widget.importbtn',


constructor: function()
{
this.text = "Importa"
this.icon = './images/extras/import-icon.gif'
this.tooltip = "Importa record da un file XLSX, XLS o CSV"
this.alias = "btnImportRecords"

this.callParent(arguments)

}
})



I include this item in many views with this syntax

items: [{xtype:"importbtn"}]


Those views that include my button are instantiated dynamically, and i need to make disabled the button, both in actual instances and those that i will instantiate in future.


I need to make the config "disabled:true" inside the object itself.


I tryied with no success:
Ext.apply("CS.view.ImportGridRecordsButton", {disabled:true})


still remains enabled

American horizon
20 Nov 2018, 3:26 AM
bump

twaindev
20 Nov 2018, 1:57 PM
Try:

this.callParent(arguments);
this.setDisabled(true);