Class clove::ListView¶
-
class
clove
::
ListView
: public clove::DataView A view which shows a clove::Datasource in a list.
Public Functions
-
datasource
() The clove::Datasource for this view.
This provides the actual data to display. See clove::NativeDatasource for a ready-to-use implementation.
-
setDatasource
(value) Setter for datasource().
- Parameters
value
: The new value.
-
dataViewProcessor
() An optional
function(ptr, value)
for processing a datasource value to a display string.
-
setDataViewProcessor
(value) Setter for dataViewProcessor().
- Parameters
value
: The new value.
-
cellGenerator
() A generator function for complex cell content.
This method is called for each cell with
(clove::Widget, clove::DatasourceValuePointer)
. It may return a widget configuration as for clove::build(). If it does, the cell is constructed with this widget as content. The content must define anupdate(clove::Widget, clove::DatasourceValuePointer, value)
method, which takes the cell datasource value and configures the inner widget according to that.
-
setCellGenerator
(value) Setter for cellGenerator().
- Parameters
value
: The new value.
-
alwaysAllocateExpanderSpace
() If some space is allocated for an expander even for cells without children.
-
setAlwaysAllocateExpanderSpace
(value) Setter for alwaysAllocateExpanderSpace().
- Parameters
value
: The new value.
-
showOnlyFirstColumn
() If to show only the first column and hide the other ones.
-
setShowOnlyFirstColumn
(value) Setter for showOnlyFirstColumn().
- Parameters
value
: The new value.
-
hideExpanders
() If to hide all expanders.
-
setHideExpanders
(value) Setter for hideExpanders().
- Parameters
value
: The new value.
-
allowSelection
() If it is allowed to select nodes.
This is always a single selection. For something like multi-selection, please check allowChecking().
-
setAllowSelection
(value) Setter for allowSelection().
- Parameters
value
: The new value.
-
allowChecking
() If it is allowed to check cells.
This is a way to select 0..n data cells. For a single-selection, please check allowSelection().
-
setAllowChecking
(value) Setter for allowChecking().
- Parameters
value
: The new value.
-
granularity
() The granularity for stuff like selection and checking.
Either
'cell'
or'row'
.
-
setGranularity
(value) Setter for granularity().
- Parameters
value
: The new value.
-
showChangeMenu
() If a menu shall be shown for making manual changes to the data source.
Instead of true, it may also be a configuration object, which may contain the following:
item_foo_label
,item_foo_icon
,item_foo_isvisible
,item_foo_action
: Specifies a menu actionfoo
by four functions. Each function getswidget, datasource
as parameters. Respectively they have to return a label, an icon, if it is actually visible, or have to execute the action. It is also possible to customize the existing actionsaddrow
,addrowbefore
,addcolumn
,addcolumnbefore
,removerow
,removecolumn
andedit
this way.
-
setShowChangeMenu
(value) Setter for showChangeMenu().
- Parameters
value
: The new value.
-
editOnGesture
() If the user shall be able to edit cells by double clicking/tapping them.
-
setEditOnGesture
(value) Setter for editOnGesture().
- Parameters
value
: The new value.
-
rowsResizable
() If the user shall be able to resize rows.
-
setRowsResizable
(value) Setter for rowsResizable().
- Parameters
value
: The new value.
-
columnsResizable
() If the user shall be able to resize columns.
-
setColumnsResizable
(value) Setter for columnsResizable().
- Parameters
value
: The new value.
-
selectCell
(ptr) Selects a cell.
- Parameters
ptr
: The clove::DatasourceValuePointer.
-
isCellSelected
(ptr) Checks if a given cell is selected.
- Parameters
ptr
: The clove::DatasourceValuePointer.
-
checkedCells
() Returns the checked cells as list of clove::DatasourceValuePointer.
-
setCheckedCells
(ptrs) Seturns the checked cells.
- Parameters
ptrs
: A list of clove::DatasourceValuePointer.
-
isCellChecked
(ptr) Checks if a given cell is checked.
- Parameters
ptr
: The clove::DatasourceValuePointer.
-
setCellChecked
(ptr, val) Sets if a given cell is checked.
- Parameters
ptr
: The clove::DatasourceValuePointer.val
: If the cells shall be checked.
-
selection
() Returns the selected item as clove::DatasourceValuePointer.
-
headersource
() The clove::Headersource providing row and column header configurations.
-
setHeadersource
(value) Setter for headersource().
- Parameters
value
: The new value.
-
gridVisible
() If to show a cell grid.
-
setGridVisible
(value) Setter for gridVisible().
- Parameters
value
: The new value.
-
nodeActivationNeedsDoubleClick
() If node activation needs a double-click.
Note: If you set this, you should find alternative ways for users of mobile devices!
-
setNodeActivationNeedsDoubleClick
(value) Setter for nodeActivationNeedsDoubleClick().
- Parameters
value
: The new value.
-
expandCell
(ptr) Expands a given cell.
- Parameters
ptr
: The clove::DatasourceValuePointer.
-
expandCellRecursive
(ptr) Expands a given cell and all parents.
- Parameters
ptr
: The clove::DatasourceValuePointer.
-
collapseCell
(ptr) Collapses a given cell.
- Parameters
ptr
: The clove::DatasourceValuePointer.
-
isCellExpanded
(ptr) Checks if a given cell is expanded.
- Parameters
ptr
: The clove::DatasourceValuePointer.
-
editCell
(ptr) Triggers the edit mode for a cell.
Only works if a method
_getdomcell(ir, ic, parent)
returns a dom node.- Parameters
ptr
: The clove::DatasourceValuePointer.
-
OnSelectionChanged
Triggered when the selection in the view changes.
This is a clove.Event instance. See Manual for details.
-
declareProperty
(k, defaultV) Declares a widget property.
This is intended to be called only from inside the widget constructor.
Read the Manual about widget properties and custom widgets.
- Parameters
k
: The widget property name.defaultV
: The default value.
-
getProperty
(k) General-purpose getter for widget properties.
Typically used for handling properties, which do not directly belong to the widget class but which are helpers for external aspects (e.g. a row index for positioning in a grid).
The known ones have a dedicated getter and setter, i.e.
x.name()
for `x.getProperty(‘name’)and
x.setName(v)` respectively.Read the Manual about widget properties.
- Parameters
k
: The widget property name.
-
setProperty
(k, v) General-purpose setter for widget properties.
See getProperty().
- Parameters
k
: The widget property name.v
: The new value.
-
bindProperty
(k, vb) Binds a DataBinding to a property. Read Manual for details about data bindings.
- Parameters
k
: The widget property name.vb
: The clove.DataBinding to bind. May be ‘undefined’ for just unbinding.
-
init
(rootNameScope) Initializes the widget.
Never override this method in custom widgets. See doresize().
Intended for usage by the infrastructure; never call this method directly.
- Parameters
rootNameScope
: The root namescope to add this widget to.
-
doinit
() Executes late widget initialization (i.e. after properties are applied).
This is used for initialization steps which need the properties to be applied already. See also doinitEarly().
Override this method in custom widgets.
Intended for usage by the infrastructure; never call this method directly.
-
doinitEarly
() Executes early widget initialization (i.e. before properties are applied).
This is used for initialization steps which need to run before property values are applied. See also doinit().
Override this method in custom widgets.
Intended for usage by the infrastructure; never call this method directly.
-
resize
() Applies the new widget size to internal content.
Never override this method in custom widgets. See doresize().
This function is typically called from the parent widget when the size has been changed.
-
doresize
() Corrects alignments of internal elements according to the new widget size.
Override this method in custom widgets.
Never call this method directly. See resize().
-
relayout
() Notifies the parent widget that a new geometry is required.
This will eventually lead to a resizing according to clove::Widget::getPreferredWidth (et al).
This function is typically called from within the widget implementation when the content changed and from child widgets.
-
focus
() Sets the focus to this widget.
-
isAlive
() Checks if the widget is still alive (i.e. mounted somewhere in the dom tree).
-
computeMinimalWidth
() Computes the minimal width in pixel this widget needs to have.
Override this method for geometry measurement in custom widgets.
-
computePreferredWidth
() Computes the preferred width in pixel this widget needs to have.
Override this method for geometry measurement in custom widgets.
-
computeMinimalHeightForWidth
(w) Computes the minimal height in pixel this widget needs to have for a given width.
Override this method for geometry measurement in custom widgets.
- Parameters
w
: The width in pixel.
-
computePreferredHeightForWidth
(w) Computes the preferred height in pixel this widget needs to have for a given width.
Override this method for geometry measurement in custom widgets.
- Parameters
w
: The width in pixel.
-
getMinimalWidth
() Returns the minimal width in pixel this widget needs to have.
Do not override this method in custom widgets. This method caches geometry and does some other adjustments.
-
getPreferredWidth
() Returns the preferred width in pixel this widget needs to have.
Do not override this method in custom widgets. This method caches geometry and does some other adjustments.
-
getMinimalHeightForWidth
(w) Returns the minimal height in pixel this widget needs to have for a given width.
Do not override this method in custom widgets. This method caches geometry and does some other adjustments.
- Parameters
w
: The width in pixel.
-
getPreferredHeightForWidth
(w) Returns the preferred height in pixel this widget needs to have for a given width.
Do not override this method in custom widgets. This method caches geometry and does some other adjustments.
- Parameters
w
: The width in pixel.
-
addStyleClass
(clss) Adds the css class
clss
to this widget.- Parameters
clss
: A css class name.
-
removeStyleClass
(clss) Removes the css class
clss
from this widget.- Parameters
clss
: A css class name.
-
isStyleClass
(clss) Checks if this widget contains the css class
clss
.- Parameters
clss
: A css class name.
-
setStyleClassAssigned
(clss, assigned) Sets or unsets the css class
clss
to this widget.- Parameters
clss
: A css class name.assigned
: If to assign or unassign it.
-
containingNameScope
() The namescope this widget contains to.
-
nameScope
() The own namescope (or the namescope it contains to, if this widget does not bring a new one).
-
remove
(removeconfig) Removes this widget.
Note: This method does not guarantee to remove the widget synchronously, since there might be animations before.
Use clove::Widget::OnDestroyed for continuing after removal.
- Parameters
removeconfig
: The removal configuration (optional and only for exotic cases).
-
effectivelyEnabled
() If this widget is enabled and not marked as busy (i.e. can interact with the user).
This checks if the parent widgets are enabled and non-busy as well. See also enabled() and busy().
-
effectiveVisibility
() If this widget and all parent widgets are visible. See also visibility().
-
childrenWidgets
() List of the children clove::Widget instances.
-
parentWidget
() The parent clove::Widget.
-
name
() The name of the widget.
This name can be used for getting the widget instance later on. Read the Manual about namescopes for details.
-
setName
(value) Setter for name().
- Parameters
value
: The new value.
-
enabled
() If this widget is marked as enabled (i.e. can interact with the user).
This does not check the parents. See also effectivelyEnabled().
-
setEnabled
(value) Setter for enabled().
- Parameters
value
: The new value.
-
styleClass
() Custom css class(es).
-
setStyleClass
(value) Setter for styleClass().
- Parameters
value
: The new value.
-
style
() Custom css style string. You should not use that, but styleClass() instead.
-
setStyle
(value) Setter for style().
- Parameters
value
: The new value.
-
visibility
() If this widget is visible.
One of clove::Visible, clove::Invisible and clove::InvisibleCollapsed.
See also effectiveVisibility().
-
setVisibility
(value) Setter for visibility().
- Parameters
value
: The new value.
-
doStandaloneResizing
() If the widget handles to resize itself as needed.
This is only needed in exotic situations and by the infrastructure.
-
setDoStandaloneResizing
(value) Setter for doStandaloneResizing().
- Parameters
value
: The new value.
-
mayFocus
() If the widget can have the keyboard focus.
-
setMayFocus
(value) Setter for mayFocus().
- Parameters
value
: The new value.
-
horizontalStretchAffinity
() Numeric value >= 0 which specifies how much this widget would benefit from additional horizontal space.
-
setHorizontalStretchAffinity
(value) Setter for horizontalStretchAffinity().
- Parameters
value
: The new value.
-
verticalStretchAffinity
() Numeric value >= 0 which specifies how much this widget would benefit from additional vertical space.
-
setVerticalStretchAffinity
(value) Setter for verticalStretchAffinity().
- Parameters
value
: The new value.
-
strictHorizontalSizing
() If the widget is strictly forbidden to get additional horizontal space.
Otherwise there are situations where additional space is assigned even with
horizontalStretchAffinity()==0
.
-
setStrictHorizontalSizing
(value) Setter for strictHorizontalSizing().
- Parameters
value
: The new value.
-
strictVerticalSizing
() If the widget is strictly forbidden to get additional vertical space.
Otherwise there are situations where additional space is assigned even with
verticalStretchAffinity()==0
.
-
setStrictVerticalSizing
(value) Setter for strictVerticalSizing().
- Parameters
value
: The new value.
-
vstretch
() Alias for verticalStretchAffinity().
-
setVstretch
(value) Setter for vstretch().
- Parameters
value
: The new value.
-
hstretch
() Alias for horizontalStretchAffinity().
-
setHstretch
(value) Setter for hstretch().
- Parameters
value
: The new value.
-
busy
() If the widget is in busy state, typically resulting in a loading animation.
-
setBusy
(value) Setter for busy().
- Parameters
value
: The new value.
-
registerBusy
() Sets the widget to busy state and returns a token which helps returning to normal state.
See also unregisterBusy() and busy().
You must not mix this function with direct usage of setBusy()!
-
unregisterBusy
(token) Drops a token and returns to normal state if no other tokens exist.
- Parameters
token
: The token as returned by registerBusy().
-
hasFocus
() If the widget has the keyboard focus.
This also returns true if a child has focus.
-
innerSize
() Returns inner width and height of this widget.
-
outerSize
() Returns outer width and height of this widget.
-
OnDestroyed
Triggered when this widget was removed somehow.
This is a clove.Event instance. See Manual for details.
-
OnResized
Triggered when this widget was resized.
This is a clove.Event instance. See Manual for details.
-
OnVisibilityChanged
Triggered when the visibility of this widget changed.
Only direct changes trigger the event, not when the visibility of a predecessor changed.
This is a clove.Event instance. See Manual for details.
-
OnPropertyChanged
Triggered whenever a property of this widget changed its value.
Note: A few properties are only computed on-demand and don’t trigger this event.
This is a clove.Event instance. See Manual for details.
-
OnKeyDown
Triggered when a keyboard key went down.
This is a clove.Event instance. See Manual for details.
-
OnKeyUp
Triggered when a keyboard key came up.
This is a clove.Event instance. See Manual for details.
-
OnKeyPress
Triggered when a keyboard key was pressed.
Note that this event does not work for all keys in all browsers!
This is a clove.Event instance. See Manual for details.
-