require(["deliteful/ScrollableContainer"], function (ScrollableContainer) { new ScrollableContainer(); })
A container widget with scrolling capabilities.
- Source:
- Source:
Members
-
baseClass :string
-
The name of the CSS class of this widget.
Type:
- string
- Default Value:
- "d-scrollable-container"
- Source:
-
containerNode :DomNode
-
Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets.
containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is undefined for widgets that don't, like TextBox.
Type:
- DomNode
- Inherited From:
- Default Value:
- undefined
- Source:
-
focused :boolean
-
This widget or a widget it contains has focus, or is "active" because it was recently clicked.
Type:
- boolean
- Inherited From:
- Default Value:
- false
- Source:
-
register :delite/register
-
Convenience pointer to register class. Used by buildRendering() functions produced from handlebars! / template.
Type:
- delite/register
- Inherited From:
- Source:
-
scrollableNode :DomNode
-
Designates the descendant node of this widget which is made scrollable. The default value is 'null'. If not set, defaults to this widget itself ('this'). Note that this property can be set only at construction time, at latest in the buildRendering() method of the widget into which this class is mixed.
Type:
- DomNode
- Inherited From:
- Default Value:
- null
- Source:
-
scrollDirection :string
-
The direction of the interactive scroll. Possible values are: "vertical", "horizontal", "both, and "none". The default value is "vertical". Note that scrolling programmatically using scrollTo() is possible on both horizontal and vertical directions independently on the value of scrollDirection.
Type:
- string
- Inherited From:
- Default Value:
- "vertical"
- Source:
Methods
-
addChild(widget, insertIndex)
Makes the given widget or DOM node a child of this widget.
-
Inserts specified child widget or DOM node as a child of this widget's container node, and possibly does other processing (such as layout).
Parameters:
Name Type Argument Description widget
DOMNode A description for widget insertIndex
int <optional>
A description for insertIndex - Inherited From:
- Source:
-
attachedCallback()
-
Called when the widget is first inserted into the document. If widget is created programatically then app must call startup() to trigger this method.
- Inherited From:
- Source:
-
createdCallback()
-
Kick off the life-cycle of a widget.
- Inherited From:
- Source:
-
defer(fcn, delay)
-
Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).
Parameters:
Name Type Description fcn
Object Function reference. delay
Object Delay, defaults to 0. - Inherited From:
- Source:
-
emit()
Signal that a synthetic event occurred, ex:
myWidget.emit("attrmodified-selectedChildWidget", {}).
-
Emits an event of specified type, based on eventObj. Also calls onType() method, if present, and returns value from that method. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).
- Inherited From:
- Source:
-
findCustomElements(Element)
-
Search subtree under root returning custom elements found.
Parameters:
Name Type Argument Description Element
<optional>
root Node to search under. - Inherited From:
- Source:
-
getChildren()
-
Returns all direct children of this widget, i.e. all widgets or DOM node underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children.
The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.
- Inherited From:
- Source:
-
getEnclosingWidget()
-
Returns the widget whose DOM tree contains the specified DOMNode, or null if the node is not contained within the DOM tree of any widget
- Inherited From:
- Source:
-
getIndexOfChild()
-
Gets the index of the child in this container or -1 if not found
- Inherited From:
- Source:
-
getNextSibling()
-
Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".
- Inherited From:
- Source:
-
getParent()
-
Returns the parent widget of this widget.
- Inherited From:
- Source:
-
getPreviousSibling()
-
Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".
- Inherited From:
- Source:
-
hasChildren()
-
Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.
- Inherited From:
- Source:
-
isBottomScroll() → {boolean}
-
Returns true if container's scroll has reached the maximum at the top of the content. Returns false otherwise.
- Inherited From:
- Source:
Returns:
- Type
- boolean
-
isFocusable()
-
Return true if this widget can currently be focused and false if not
- Inherited From:
- Source:
-
isLeftToRight()
-
Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
- Inherited From:
- Source:
-
isTopScroll() → {boolean}
-
Returns true if container's scroll has reached the maximum at the top of the content. Returns false otherwise.
- Inherited From:
- Source:
Returns:
- Type
- boolean
Example
scrollContainer.on("scroll", function () { if (scrollContainer.isTopScroll()) { console.log("Scroll reached the maximum at the top"); } }
-
mix()
-
Set a hash of properties on a Stateful instance
- Inherited From:
- Source:
Example
myObj.mix({ foo: "Howdy", bar: 3 })
-
on()
-
Call specified function when event occurs, ex: myWidget.on("click", function () { ... }).
- Inherited From:
- Source:
-
onBlur()
-
Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.
- Inherited From:
- Source:
-
onFocus(e)
-
Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.
Parameters:
Name Type Description e
event A focus event. - Inherited From:
- Source:
-
own()
-
Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.
- Inherited From:
- Source:
-
placeAt(reference, position)
Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.
-
A convenience function provided in all _Widgets, providing a simple shorthand mechanism to put an existing (or newly created) Widget somewhere in the dom, and allow chaining.
Parameters:
Name Type Argument Description reference
String | DomNode | Widget Widget, DOMNode, or id of widget or DOMNode position
String | Int <optional>
If reference is a widget (or id of widget), and that widget has an ".addChild" method, it will be called passing this widget instance into that method, supplying the optional position index passed. In this case position (if specified) should be an integer. If reference is a DOMNode (or id matching a DOMNode but not a widget), the position argument can be a numeric index or a string "first", "last", "before", or "after", same as dojo/dom-construct::place().
- Inherited From:
- Source:
-
processConstructorParameters()
-
Called after Object is created to process parameters passed to constructor.
- Inherited From:
- Source:
-
removeChild(widget)
-
Removes the passed widget instance from this widget but does not destroy it. You can also pass in an integer indicating the index within the container to remove (ie, removeChild(5) removes the sixth widget).
Parameters:
Name Type Description widget
Element | int - Inherited From:
- Source:
-
scrollBy(by, duration)
-
Scrolls by the given amount.
Parameters:
Name Type Description by
object The scroll amount. An object with x and/or y properties, for example {x:0, y:-5} or {y:-29}. duration
number Duration of scrolling animation in milliseconds. If 0 or unspecified, scrolls without animation. - Inherited From:
- Source:
-
startup()
Processing after the DOM fragment is added to the document
-
Called after a widget and its children have been created and added to the page, and all related widgets have finished their create() cycle, up through postCreate().
Note that startup() may be called while the widget is still hidden, for example if the widget is inside a hidden deliteful/Dialog or an unselected tab of a deliteful/TabContainer. For widgets that need to do layout, it's best to put that layout code inside resize(), and then extend delite/_LayoutWidget so that resize() is called when the widget is visible.
- Inherited From:
- Source:
-
watch()
-
Watches a property for changes.
- Inherited From:
- Source: