dojox/grid/enhanced/plugins/DnD (version 1.10)

dojox/grid/enhanced/_Plugin

Summary

Provide drag and drop for grid columns/rows/cells within grid and out of grid. The store of grid must implement dojo.data.api.Write.

DnD selected columns: Support moving within grid, moving/copying out of grid to a non-grid DnD target.

DnD selected rows: Support moving within grid, moving/copying out of grid to any DnD target.

DnD selected cells (in rectangle shape only): Support moving/copying within grid, moving/copying out of grid to any DnD target.

Usage

var foo = new DnD(grid,args);
dojox/grid/enhanced/plugins/DnD
Parameter Type Description
grid undefined
args undefined

Property Summary

  • _config
  • _connectsList of all connections.
  • _copyOnly
  • _subscribesList of all subscribes.
  • _targetAnchorBorderWidth
  • gridGrid that the plugin belongs to
  • nameplugin name;
  • optionPlugin 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"], ...}
  • privatesPrivate properties/methods shouldn't be mixin-ed anytime.

Method Summary

Event Summary

Properties

_config
_connects

List of all connections.

_copyOnly
_subscribes

List of all subscribes.

_targetAnchorBorderWidth
grid

Grid that the plugin belongs to

name

plugin name;

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

_allDnDItemsLoaded()
Returns:boolean
_calcCellTargetAnchorPos(evt,containerPos,targetAnchor)

Calculate the position of the cell DnD avatar

Parameter Type Description
evt undefined
containerPos undefined
targetAnchor undefined
Returns:object
_calcColTargetAnchorPos(evt,containerPos)

Calculate the position of the column DnD avatar

Parameter Type Description
evt undefined
containerPos undefined
Returns:number
_calcRowTargetAnchorPos(evt,containerPos)

Calculate the position of the row DnD avatar

Parameter Type Description
evt undefined
containerPos undefined
Returns:number
_canAccept(sourcePlugin)
Parameter Type Description
sourcePlugin undefined
Returns:boolean | undefined
_clear()
_createDnDUI(evt,isMovingIn)
Parameter Type Description
evt undefined
isMovingIn undefined
_createMoveable(evt)
Parameter Type Description
evt undefined
_createSource(evt)
Parameter Type Description
evt undefined
_destroyDnDUI(isMovingOut,destroySource)
Parameter Type Description
isMovingOut undefined
destroySource undefined
_destroyMoveable()
_destroySource()
_endDnd(destroySource)
Parameter Type Description
destroySource undefined
_getDnDRegion(rowIndex,colIndex)
Parameter Type Description
rowIndex undefined
colIndex undefined
Returns:null | object
_getVisibleHeaders()
Returns:undefined
_initEvents()
_isOutOfGrid(evt)
Parameter Type Description
evt undefined
Returns:boolean
_mapRegion(srcGrid,dndRegion)
Parameter Type Description
srcGrid undefined
dndRegion undefined
Returns:undefined
_markTargetAnchor(evt)
Parameter Type Description
evt undefined
_mixinGrid()

Provide APIs for grid.

_rearrange()
_startDnd(evt)
Parameter Type Description
evt undefined
_unmarkTargetAnchor()
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
});
copyOnly(isCopyOnly)

Setter/getter of this._copyOnly.

Parameter Type Description
isCopyOnly undefined
Returns:boolean
destroy()
disconnect(handle)

Disconnects handle and removes it from connection list.

Parameter Type Description
handle undefined
init()
setupConfig(config)

Configure which DnD functionalities are needed. Combination of any item from type set ("row", "col", "cell") and any item from mode set("within", "in", "out") is configurable.

"row", "col", "cell" are straightforward, while the other 3 are explained below:

  • "within": DnD within grid, that is, column/row reordering and cell moving/copying.
  • "in": Whether allowed to accept rows/cells (currently not support columns) from another grid.
  • "out": Whether allowed to drag out of grid, to another grid or even to any other DnD target.

If not provided in the config, will use the default. When declared together, Mode set has higher priority than type set.

Parameter Type Description
config Object

DnD configuration object. See the examples below.

Examples

Example 1

The following code disables row DnD within grid, but still can drag rows out of grid or drag rows from other gird.

setUpConfig({
    "row": {
        "within": false
    }
});

The opposite way is also okay:

setUpConfig({
    "within": {
        "row": false
    }
});

And if you'd like to disable/enable a whole set, here's a shortcut:

setUpConfig({
    "cell", true,
    "out": false
});

Because mode has higher priority than type, the following will disable row dnd within grid:

setUpConfig({
    "within", {
        "row": false;
    },
    "row", {
        "within": true
    }
});
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

_onMouseMove(evt)
Parameter Type Description
evt 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
});
_onMouseUp()

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
});
onDraggingOut(sourcePlugin)
Parameter Type Description
sourcePlugin 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
});
onDraggingOver(sourcePlugin)
Parameter Type Description
sourcePlugin 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
});
onDragIn(sourcePlugin,isCopy)
Parameter Type Description
sourcePlugin undefined
isCopy 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
});
onDragOut(isMove)
Parameter Type Description
isMove 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
});
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!