Base class for all plugins.
Provides common plugin functionality and basic life cycle management.
Each concrete plugin must have a name field and is responsible for registering itself to the global plugin registry e.g. for dnd plugin:
dojox.grid.EnhancedGrid.registerPlugin("dnd" /*plugin name*/, dojox.grid.enhanced.plugins.DnD /*full class name of a plugin*/ {"preInit": false, "dependency": ["nestedSorting"]} /*properties*/);
[Keywords] of plugin properties (case sensitive):
Parameter | Type | Description |
---|---|---|
inGrid | dojox/grid/EnhancedGrid | The grid to plug in to. |
option | undefined |
declare("mygrid.MyDnD", dojox.grid.enhanced.plugins.DnD, { name:"dnd" //still reuse the plugin name constructor: function(inGrid, option){ ... } }); dojox.grid.EnhancedGrid.registerPlugin("dnd", mygrid.MyDnD);
declare("mygrid.PluginA", dojox.grid.enhanced._Plugin, { name: "pA", constructor: function(inGrid, option){ ... } }); dojox.grid.EnhancedGrid.registerPlugin("pA",mygrid.PluginA);
dojo.require("mygrid.MyDnD"); dojo.require("mygrid.PluginA"); <script type="text/javascript"> var grid = new dojox.grid.EnhancedGrid( {plugins: {dnd:true, pA:true}, ... }, dojo.byId("gridDiv")); grid.startup(); </script>
Plugin properties - leveraged with default and user specified properties. e.g. for dnd plugin, it may look like {"class": dojox.grid.enhanced.plugins.DnD, "dependency": ["nestedSorting"], ...}
Private properties/methods shouldn't be mixin-ed anytime.
Connects specified obj/event to specified method of this object.
Parameter | Type | Description |
---|---|---|
obj | undefined | |
event | undefined | |
method | undefined |
var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...}); // when foo.bar() is called, call the listener in the scope of plugin plugin.connect(foo, "bar", function(){ console.debug(this.xxx());//"this" - plugin scope });
Disconnects handle and removes it from connection list.
Parameter | Type | Description |
---|---|---|
handle | undefined |
Subscribes to the specified topic and calls the specified method of this object.
Parameter | Type | Description |
---|---|---|
topic | undefined | |
method | undefined |
var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...}); // when /my/topic is published, call the subscriber in the scope of plugin // with passed parameter - "v" plugin.subscribe("/my/topic", function(v){ console.debug(this.xxx(v));//"this" - plugin scope });
Un-subscribes handle and removes it from subscriptions list.
Parameter | Type | Description |
---|---|---|
handle | undefined |
var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...}); // when /my/topic is published, call the subscriber in the scope of plugin // with passed parameter - "v" plugin.subscribe("/my/topic", function(v){ console.debug(this.xxx(v));//"this" - plugin scope });
var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...}); // when /my/topic is published, call the subscriber in the scope of plugin // with passed parameter - "v" plugin.subscribe("/my/topic", function(v){ console.debug(this.xxx(v));//"this" - plugin scope });
Called when store is changed.
Parameter | Type | Description |
---|---|---|
store | undefined |
var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...}); // when /my/topic is published, call the subscriber in the scope of plugin // with passed parameter - "v" plugin.subscribe("/my/topic", function(v){ console.debug(this.xxx(v));//"this" - plugin scope });
var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...}); // when /my/topic is published, call the subscriber in the scope of plugin // with passed parameter - "v" plugin.subscribe("/my/topic", function(v){ console.debug(this.xxx(v));//"this" - plugin scope });