Constructor
new module:caplin/grid/operation/ColumnReorderingOperation(oPolicy, configopt)
Tracks a reordering operation within a component.
It reorders horizontally arranged columns. Columns are composed of a header and a body.
The header is draggable, while both the header and body are proxied and shielded druing the operation.
hint functions are called during the reordering to indicate the planned action.
action functions are called when the operation ends to carry out the planned action.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
oPolicy |
Object | Notified of [confirmReorder,isFixed,identifyBody,onReorderStarted,reorderColumn,selectColumn,cancelColumn,scrollHorizontallyTo] | |
config |
Map |
<optional> |
tweaks to how the drag works. Which elements can be dragged. |
Methods
-
cloneOriginBody(pElements, configopt)
-
Use by onReorderStarted
Parameters:
Name Type Attributes Description pElements
Array config
Map <optional>
className & tagName attributes for clone -
cloneOriginHeader(pElements, config)
-
Use by onReorderStarted
Parameters:
Name Type Description pElements
Array config
Map Optional className & tagName attributes for clone -
forget()
-
Forget any cached information
-
getContainerElement() → {HTMLElement}
-
Returns:
- Type
- HTMLElement
-
getHeaderBoundingElement() → {HTMLElement}
-
Returns:
- Type
- HTMLElement
-
getHorizontalScrollElement() → {HTMLElement}
-
Returns:
- Type
- HTMLElement
-
getShieldBorderSpace()
-
Returns the border dimensions, along with the top offset. {width,height,top} in pixels of the shield border and top offset.
Returns:
border dimensions -
isReordering() → {boolean}
-
Returns:
Is a reordering operation in progress- Type
- boolean
-
isSnapping() → {boolean}
-
Returns:
Is a snapping operation in progress- Type
- boolean
-
moveColumn(oEvent) → {boolean}
-
Attempt to start a column move. Call this method in a mousedown event handler. It will start the operation if appropriate.
Parameters:
Name Type Description oEvent
DOMEvent Event passed from the mousedown event handler. Returns:
true if a column move has started- Type
- boolean
-
recalcColumns()
-
Recalculate column information from the DOM Elements. Call if the columns are visually changed by something other than the operation. Precalc is currently disabled. All calculations are done during mouse down, so this function is of limited use.
-
setContainerElement(eContainer)
-
Container element within which the operation takes place. Shield and clone elements are added as children of this. This must be set. The operation is assumed to happen on columns within the same container.
Parameters:
Name Type Description eContainer
DOMElement -
setHeaderBoundingElement(eBounding)
-
Restrict the draggable elements to be descendants of a single ancestor. This must be an ancestor common to all headers
Parameters:
Name Type Description eBounding
DOMElement Common header ancestor -
setHorizontalScrollElement(eScroll)
-
Set the element that contains the horizontal scroll bar. This can be the same as the container or a separate element. The widths and scroll offset of this element will be used to adjust for and control scrolling
Parameters:
Name Type Description eScroll
DOMElement Element containing the scroll bar. -
setProxyStyle(mStyles)
-
Use in onReorderStarted callback
Parameters:
Name Type Description mStyles
Map Map of style name & value -
setShieldStyle(mStyles)
-
Use in onReorderStarted callback
Parameters:
Name Type Description mStyles
Map Map of style name & value -
trackClone(nDiff, bHappyScroll)
-
Update proxy of column to left offset
Parameters:
Name Type Description nDiff
int Movement in pixels from origin bHappyScroll
boolean start scrolling when touching edge, rather than when 10 pixels past edge StartOperation and mouse move causes trackClone normal Snapping causes trackClone with happy scroll -
updateProxyBodyHeight()
-
Give the proxy body the remaining height.