Caplin Trader 5.1.0

Class: module:ct-grid/operation/ColumnReorderingOperation

module:ct-grid/operation/ColumnReorderingOperation(policy, configopt)

new module:ct-grid/operation/ColumnReorderingOperation(policy, 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
policy object

Notified of [confirmReorder,isFixed,identifyBody,onReorderStarted,reorderColumn,selectColumn,cancelColumn,scrollHorizontallyTo]

config object <optional>

tweaks to how the drag works. Which elements can be dragged.

Properties
Name Type Attributes Default Description
fDragSelector string <optional>
'div'

the query selector used to locate the elements that can be reordered.

Methods

cloneOriginBody(elements, configopt)

Use by onReorderStarted

Parameters:
Name Type Attributes Description
elements qrray
config object <optional>

clone config

Properties
Name Type Attributes Default Description
className string <optional>
''

The CSS class for the clone element.

tagName string <optional>
'div'

The HTML element tag for the clone element.

cloneOriginHeader(elements, configopt)

Use by onReorderStarted

Parameters:
Name Type Attributes Description
elements qrray
config object <optional>

clone config

Properties
Name Type Attributes Default Description
className string <optional>
''

The CSS class for the clone element.

tagName string <optional>
'div'

The HTML element tag for the clone element.

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(event) → {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
event 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(styles)

Use in onReorderStarted callback

Parameters:
Name Type Description
styles object

Map of style name & value

setShieldStyle(styles)

Use in onReorderStarted callback

Parameters:
Name Type Description
styles object

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.