Plugins | Extjs
updateButtonVisibility: function(field, newVal) this.clearBtn.setVisible(!Ext.isEmpty(newVal));
init: function(host) console.log('Plugin init on', host.$className); this.host = host; // ... rest
xtype: 'grid', plugins: [ type: 'toolbardock', position: 'top', items: [ text: 'Save' ] ] extjs plugins
toggleRow: function(view, rowIdx, colIdx, item, e, record) var row = view.getRow(rowIdx); if (row && row.nextSibling && row.nextSibling.classList.contains('x-row-expander-detail')) Ext.fly(row.nextSibling).destroy(); else this.showDetail(row, record); ,
); Ext.define('MyApp.plugin.Clearable', extend: 'Ext.plugin.Abstract', alias: 'plugin.clearable', init: function(field) this.field = field; field.on('afterrender', this.addClearButton, this); , updateButtonVisibility: function(field, newVal) this
Plugin Aliases and Lazy Instantiation // In plugin definition Ext.define('MyApp.plugin.ToolbarDock', alias: 'plugin.toolbardock' ); // In component config
); | Method | When Called | |--------|-------------| | init(host) | After host component initialization, before rendering | | destroy() | When host component is destroyed (cleanup) | | enable() / disable() | If plugin supports enabling/disabling | | setConfig() | For dynamic reconfiguration | init: function(host) console.log('Plugin init on'
destroy: function() if (this.host) this.host.un('someevent', this.handler, this); delete this.host; this.callParent();