dojox/grid/enhanced/_Plugin (version 1.10)

Summary

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):

Usage

var foo = new _Plugin(inGrid,option);
dojox/grid/enhanced/_Plugin
Parameter Type Description
inGrid dojox/grid/EnhancedGrid

The grid to plug in to.

option undefined

Examples

Example 1

  1. Customize default DnD plugin
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);
  1. Add new plugin - PluginA
declare("mygrid.PluginA", dojox.grid.enhanced._Plugin, {
    name: "pA",
    constructor: function(inGrid, option){ ... }
});
dojox.grid.EnhancedGrid.registerPlugin("pA",mygrid.PluginA);
  1. Use plugins
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>

Property Summary

  • _connectsList of all connections.
  • _subscribesList of all subscribes.
  • gridGrid that the plugin belongs to
  • namePlugin name, e.g. &#39;nestedSorting&#39;, &#39;dnd&#39;...
  • optionPlugin properties - leveraged with default and user specified properties. e.g. for dnd plugin, it may look like {&quot;class&quot;: dojox.grid.enhanced.plugins.DnD, &quot;dependency&quot;: [&quot;nestedSorting&quot;], ...}
  • privatesPrivate properties/methods shouldn&#39;t be mixin-ed anytime.

Method Summary

  • connect(obj,event,method) Connects specified obj/event to specified method of this object.
  • destroy() Destroy all resources.
  • disconnect(handle) Disconnects handle and removes it from connection list.
  • init()
  • subscribe(topic,method) Subscribes to the specified topic and calls the specified method of this object.
  • unsubscribe(handle) Un-subscribes handle and removes it from subscriptions list.

Event Summary

Properties

_connects

List of all connections.

_subscribes

List of all subscribes.

grid

Grid that the plugin belongs to

name

Plugin name, e.g. 'nestedSorting', 'dnd'...

option

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"], ...}

privates

Private properties/methods shouldn't be mixin-ed anytime.

Methods

connect(obj,event,method)

Connects specified obj/event to specified method of this object.

Parameter Type Description
obj undefined
event undefined
method undefined
Returns:undefined

Examples

Example 1

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
});
destroy()

Destroy all resources.

disconnect(handle)

Disconnects handle and removes it from connection list.

Parameter Type Description
handle undefined
init()
subscribe(topic,method)

Subscribes to the specified topic and calls the specified method of this object.

Parameter Type Description
topic undefined
method undefined
Returns:undefined

Examples

Example 1

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
});
unsubscribe(handle)

Un-subscribes handle and removes it from subscriptions list.

Parameter Type Description
handle undefined

Events

onPostInit()

Examples

Example 1

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
});
onPreInit()

Examples

Example 1

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
});
onSetStore(store)

Called when store is changed.

Parameter Type Description
store undefined

Examples

Example 1

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
});
onStartUp()

Examples

Example 1

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
});
Error in the documentation? Can’t find what you are looking for? Let us know!