Created
June 23, 2011 13:55
-
-
Save christocracy/1042573 to your computer and use it in GitHub Desktop.
Adding plugins from within a plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Ext.define('GridScaffold', { | |
| extend: 'Ext.AbstractPlugin', | |
| alias: 'plugin.grid.Scaffold', | |
| enableDD: false, | |
| constructor: function(config) { | |
| var grid = config.cmp; | |
| grid.items = grid.items || []; | |
| if (config.enableDD) { | |
| // construct a sub-plugin within another but have call #constructPlugin at this point. | |
| grid.plugins.push(grid.constructPlugin({ | |
| ptype: 'grid.DD' | |
| })); | |
| } | |
| grid.items.push({ | |
| xtype: 'component', | |
| html: 'grid.Scaffold: <b>enabled</b>' | |
| }); | |
| this.callParent(); | |
| }, | |
| init: function(grid) {} | |
| }); | |
| /** | |
| * @class GridDD plugin | |
| */ | |
| Ext.define('GridDD', { | |
| extend: 'Ext.AbstractPlugin', | |
| alias: 'plugin.grid.DD', | |
| constructor: function(config) { | |
| var grid = config.cmp; | |
| grid.items = grid.items || []; | |
| grid.items.push({ | |
| xtype: 'component', | |
| html: 'grid.DD: <b>enabled</b>' | |
| }); | |
| }, | |
| init: function(grid) {} | |
| }); | |
| Ext.onReady(function() { | |
| Ext.create('Ext.panel.Panel', { | |
| plugins: [{ | |
| ptype: 'grid.Scaffold', | |
| enableDD: true | |
| }], | |
| renderTo: document.body, | |
| enableDD: true, | |
| width: 400, | |
| height: 300, | |
| title: 'MyGrid' | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment