Class Plugin.Sortable
- extends Base
The class allows you to create a Drag & Drop reordered list.
Properties
_sortables
- private static Array
Hash map of all Sortables on the page.
A reference to the DD.Delegate instance.
Properties inherited from Base:
Methods
private
void
_join_full
(
Sortable
)
Joins both of the Sortables together.
- Parameters:
-
Sortable
<object>
sel The Sortable list to join with
private
void
_join_inner
(
Sortable
)
Allows this Sortable to give items to the passed Sortable.
- Parameters:
-
Sortable
<object>
sel The Sortable list to join with
private
void
_join_none
(
Sortable
)
Removes the join with the passed Sortable.
- Parameters:
-
Sortable
<object>
sel The Sortable to remove the join from
private
void
_join_outer
(
Sortable
)
Allows this Sortable to accept items from the passed Sortable.
- Parameters:
-
Sortable
<object>
sel The Sortable list to join with
private
void
_onDragEnd
(
Event
)
Handles the DragEnd event that cleans up the settings in the drag:start event.
- Parameters:
-
Event
<object>
e The Event Object
private
void
_onDragOver
(
Event
)
Handles the DragOver event that moves the object in the list or to another list.
- Parameters:
-
Event
<object>
e The Event Object
private
void
_onDragStart
(
Event
)
Handles the DragStart event and initializes some settings.
- Parameters:
-
Event
<object>
e The Event Object
private
void
_onDropOver
(
Event
)
Handles the DropOver event to append a drop node to an empty target
- Parameters:
-
Event
<object>
e The Event Object
static
void
_test
(
node
,
test
)
Test a Node or a selector for the container
- Parameters:
-
node
<Node>
The node instance to test.
-
test
<String|Node>
The node instance or selector string to test against.
void
getOrdering
(
Function
)
A custom callback to allow a user to extract some sort of id or any other data from the node to use in the "ordering list" and then that data should be returned from the callback.
- Parameters:
-
Function
<object>
callback
static
void
getSortable
(
node
)
Get a Sortable instance back from a node reference or a selector string.
- Parameters:
-
node
<String|Node>
The node instance or selector string to use to find a Sortable instance.
void
join
(
Sortable
,
String
)
Join this Sortable with another Sortable instance.
- full: Exchange nodes with both lists.
- inner: Items can go into this list from the joined list.
- outer: Items can go out of the joined list into this list.
- none: Removes the join.
- Parameters:
-
Sortable
<object>
sel The Sortable list to join with
-
String
<object>
type The type of join to do: full, inner, outer, none. Default: full
Chainable: This method is chainable.
void
plug
(
Class
,
Object
)
Passthrough to the DD.Delegate.ddplug method
- Parameters:
-
Class
<object>
cls The class to plug
-
Object
<object>
config The class config
Chainable: This method is chainable.
static
void
reg
(
Sortable
)
Register a Sortable instance with the singleton to allow lookups later.
- Parameters:
-
Sortable
<object>
s A Sortable instance.
static
void
unreg
(
Sortable
)
Unregister a Sortable instance with the singleton.
- Parameters:
-
Sortable
<object>
s A Sortable instance.
Methods inherited from EventTarget:
_getType,
_monitor,
_parseType,
addTarget,
after,
before,
bubble,
detach,
detachAll,
fire,
getEvent,
getTargets,
on,
once,
publish,
removeTarget,
subscribe,
unsubscribe,
unsubscribeAll
Methods inherited from Attribute:
_addAttrs,
_addLazyAttr,
_defAttrChangeFn,
_fireAttrChange,
_getAttr,
_getAttrCfg,
_getAttrInitVal,
_getAttrs,
_getStateVal,
_isLazyAttr,
_normAttrVals,
_protectAttrs,
_set,
_setAttr,
_setAttrs,
_setAttrVal,
_setStateVal,
addAttr,
addAttrs,
attrAdded,
get,
getAttrs,
modifyAttr,
removeAttr,
reset,
set,
setAttrs
Methods inherited from Base:
_aggregateAttrs,
_defDestroyFn,
_defInitFn,
_destroyHierarchy,
_filterAttrCfs,
_getAttrCfgs,
_getClasses,
_initHierarchy,
_initHierarchyData,
_preInitEventCfg,
destroy,
init,
toString
Events
containerChange
(
event
)
Fires when the value for the configuration attribute 'container' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
copy
(
event
)
A Sortable node was moved.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following specific property added:
- same
- Moved to the same list.
- drag
- The Drag Object
- drop
- The Drop Object
-
event
<Event.Facade>
An Event Facade object with the following specific property added:
- same
- Moved to the same list.
- drag
- The Drag Object
- drop
- The Drop Object
-
event
<Event.Facade>
An Event Facade object with the following specific property added:
- same
- Moved to the same list.
- drag
- The Drag Object
- drop
- The Drop Object
-
event
<Event.Facade>
An Event Facade object with the following specific property added:
- same
- Moved to the same list.
- drag
- The Drag Object
- drop
- The Drop Object
-
event
<Event.Facade>
An Event Facade object with the following specific property added:
- same
- Moved to the same list.
- drag
- The Drag Object
- drop
- The Drop Object
handlesChange
(
event
)
Fires when the value for the configuration attribute 'handles' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
idChange
(
event
)
Fires when the value for the configuration attribute 'id' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
invalidChange
(
event
)
Fires when the value for the configuration attribute 'invalid' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
moveTypeChange
(
event
)
Fires when the value for the configuration attribute 'moveType' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
nodesChange
(
event
)
Fires when the value for the configuration attribute 'nodes' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
opacityChange
(
event
)
Fires when the value for the configuration attribute 'opacity' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
opacityNodeChange
(
event
)
Fires when the value for the configuration attribute 'opacityNode' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event
<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
Events inherited from Base:
Configuration Attributes
A selector query to get the container to listen for mousedown events on. All "nodes" should be a child of this container.
Drag handles to pass on to the internal DD.Delegate instance.
id
- String
The id of this Sortable, used to get a reference to this Sortable list from another list.
A selector string to test if a list item is invalid and not sortable
How should an item move to another list: insert, swap, move, copy. Default: insert
A selector query to get the children of the "container" to make draggable elements from.
The opacity to change the proxy item to when dragging.
The node to set opacity on when dragging (dragNode or currentNode). Default: currentNode.
Configuration attributes inherited from Base: