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

dojox/grid/enhanced/_Plugin

Summary

Provides nested sorting feature

A flexible way to control multiple column sorting, including

  1. Set default sorting order
  2. Disable sorting for certain columns
  3. Set sorting order dynamically with JS API

Usage

var foo = new NestedSorting();
dojox/grid/enhanced/plugins/NestedSorting

Examples

Example 1

<script type="text/javascript">
    var grid = new dojox.grid.EnhancedGrid({plugins : {nestedSorting: true}},
               sortFields: [{attribute: 'col4', descending: false},...],//set default sorting order
               canSort: function(index, field){ return true},//disable sorting for a column
               ... }, dojo.byId('gridDiv'));
    grid.startup();
    //set new sorting order
    grid.setSortIndex([{attribute: 'col3', descending: true},...])
</script>

Property Summary

  • _a11yText
  • _connectsList of all connections.
  • _currMainSort
  • _currRegionIdx
  • _subscribesList of all subscribes.
  • 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 {&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

Event Summary

Properties

_connects

List of all connections.

_currMainSort
_currRegionIdx
_subscribes

List of all subscribes.

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

_blurHeader(e)
Parameter Type Description
e undefined
Returns:boolean
_blurRegion(region)
Parameter Type Description
region undefined
_doSort(cellIdx)
Parameter Type Description
cellIdx undefined
_focusHeader(e)

Overwritten, see _FocusManager.focusHeader()

Parameter Type Description
e undefined
Returns:boolean
_focusRegion(region)

Focus the given region

Parameter Type Description
region undefined
_getCellByNode(node)
Parameter Type Description
node undefined
Returns:undefined | null
_getCurrentRegion()
Returns:null
_getRegionHeader(region)
Parameter Type Description
region undefined
Returns:undefined
_getRegions()
Returns:Array
_getRegionView(region)
Parameter Type Description
region undefined
Returns:null
_initHeaderNode(node)

Initiate sort for each header cell node

Parameter Type Description
node undefined
_initSort(postSort)

Initiate sorting

Parameter Type Description
postSort undefined
_loadNestedSortingProps(sortInfo,grid)
Parameter Type Description
sortInfo undefined
grid undefined
_prepareNestedSort(cellIdx)

Prepare the nested sorting, this will order the column on existing sorting result.

Parameter Type Description
cellIdx undefined
_prepareSingleSort(cellIdx)

Prepare the single sort, also called main sort, this will clear any existing sorting and just sort the grid by current column.

Parameter Type Description
cellIdx undefined
_saveNestedSortingProps(grid)
Parameter Type Description
grid undefined
Returns:undefined
_setGridSortIndex(inIndex,inAsc,noRefresh)
Parameter Type Description
inIndex undefined
inAsc undefined
noRefresh undefined
_updateHeaderNodeUI(node)

Update the column header UI based on current sorting state. Show indicator of the sorting order of the column, no order no indicator

Parameter Type Description
node undefined
_updateSortDef()
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
});
disconnect(handle)

Disconnects handle and removes it from connection list.

Parameter Type Description
handle undefined
getSortProps()

Overwritten, see DataGrid.getSortProps()

Returns:null
init()
initCookieHandler()
isAsc(cellIndex)
Parameter Type Description
cellIndex undefined
Returns:boolean
isDesc(cellIndex)
Parameter Type Description
cellIndex undefined
Returns:boolean
removeSortData(cellIdx)
Parameter Type Description
cellIdx undefined
setSortData(cellIdx,attr,value)

Set sorting data for a column.

Parameter Type Description
cellIdx undefined
attr undefined
value undefined
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

_onColumnDnD(type,mapping)

Update nested sorting after column moved

Parameter Type Description
type undefined
mapping 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
});
_onHeaderCellClick(e)

See dojox.grid.enhanced._Events._onHeaderCellClick()

Parameter Type Description
e 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
});
_onHeaderCellMouseOut(e)

See dojox.grid.enhanced._Events._onHeaderCellMouseOut()

Parameter Type Description
e 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
});
_onHeaderCellMouseOver(e)

See dojox.grid._Events._onHeaderCellMouseOver() When user mouseover other columns than sorted column in a single sorted grid, We need to show 1 in the sorted column

Parameter Type Description
e 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
});
_onKeyDown(e,isBubble)
Parameter Type Description
e undefined
isBubble 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
});
_onMove(rowStep,colStep,e)
Parameter Type Description
rowStep undefined
colStep undefined
e 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
});
_onMoveColumn(sourceViewIndex,destViewIndex,cellIndex,targetIndex,before)
Parameter Type Description
sourceViewIndex undefined
destViewIndex undefined
cellIndex undefined
targetIndex undefined
before 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
});
_onSortBtnClick(e)

If the click target is single sort button, do single sort. Else if the click target is nested sort button, do nest sort. Otherwise return.

Parameter Type Description
e 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!