class SAPO.Component.SortableList
CHECK OUT SAPO.Ink.SortableList, which offers a more updated component which the same purpose Creates a sortable list - its elements can be reordered by dragging vertically.
 It can be populated two ways:
 - pass on UL with LI children
 - pass on empty UL and Array of Strings in options.values

 

requires SAPO.Dom.Event

requires SAPO.Dom.Css

requires SAPO.Dom.Element

Authors:
jose.p.dias AT co.sapo.pt
Version:
0.1
Since:
December 2010
Deprecated:
Defined in Component/SortableList/0.1/lib.js

Constructor Summary
SortableList (String|DOMElement element, Object options)

Function Summary
addChild (String value)
adds element to end of list
deleteChild (String|DOMElement childLI)
deletes child LI
destroy (Boolean all)
removes any dependecies
returns array of String
init (String|DomElement element, [Object options])
render()
renders any additional DOM/CSS content

Constructor Details

constructor SortableList

SortableList(String|DOMElement element, Object options)
Parameters:
element - element which will be enriched (or its id)
options - optional object to pass on options
  • [ Array values ] - array of string with elements to populate
  • [ String layout ] - one of 'vertical', 'horizontal' (defaults to 'vertical').
  • [ Function onChildrenChanged ] - callback function that gets called on changes (reordering, creation or deletion of child elements)
  • [ Function onDown ] - callback function that determines if a click begins dragging or not
  • [ Boolean generateDeleteElements ] - true to auto-generate buttons of class deleteElementClass on deleteButtonsPosition
  • [ String|DOMElement deleteElement ] - to supply an example element which will be used if generateDeleteElements is true. deleteElementClass is auto-populated from its class element, which must be defined.
  • [ String deleteElementPosition ] - either 'left' or 'right' (left to generate before content, right to generate after it)
  • [ String deleteElementClass ] - class name of element to look for to delete a LI element
  • [ String|DOMElement overflowContainer ] - for the component to support being inside an element with overflow="auto", one must pass it on
  • [ Number zIndex ] - CSS property zIndex to apply to element during drag (defaults to 100)
  • [ String dragIconClass ] - only allows drag of LI within the element with the given className. dragIcon should be child of LI
  • [ String deleteConfirmationMsg ] - text to display on delete confirmation (if ommited, delete is not confirmed at all)

Function Details

function addChild

addChild(String value)
adds element to end of list
Parameters:
value

function deleteChild

deleteChild(String|DOMElement childLI)
deletes child LI
Parameters:
childLI

function destroy

destroy(Boolean all)
removes any dependecies
Parameters:
all - deletes liChildren too

function getValues

Array getValues()
returns array of String Use to obtain the contents of the list in order NOTE: Trims and XML stuff (based on first < character)
Returns:
array with content of LI elements

function init

init(String|DomElement element, [Object options])
Parameters:
element - element which will be enriched (or its id)
[options] - optional object to pass on options
See also:

function render

render()
renders any additional DOM/CSS content