DataTableMapper¶
- class spectacoular.factory.DataTableMapper(obj, traitname)¶
Bases:
TraitWidgetMapper
Factory that creates
DataTable
widget from a class trait attribute.- create_widget(**kwargs)¶
creates a Bokeh
DataTable
widget instance from class trait attribute.Creates a bokeh DataTable instance. For transposed arrays that are mapped to the DataTable, array data is reshaped and casted to fit the required dictionary format of the ColumnDataSource. In case of list types, only one-dimensional lists are allowed. The transposed attribute will have no effect.
- Parameters:
- **kwargsargs of DataTable
additional arguments of DataTable widget.
- Returns:
- instance(DataTable).
- set_widget(widget)¶
connects a Bokeh DataTable widget instance to a class trait attribute.
The current implementation of set_widget can only handle non-transposed mappings. Meaning that columns of the arraytrait have to be columns in the ColumnDataSource (not rows).
- Parameters:
- widgetinstance(DataTable)
instance of a DataTable widget.
- **kwargsdict
additional arguments of DataTableMapper.
- Returns:
- None.
- create_columns()¶
create single TableColumn and add to widget
- create_trait_setter_func()¶
creates a function that casts the type of a widget value into the type of the class trait attribute.
the function is evoked every time the widget value changes. The value of a
Select
, :class: TextInput, …, widget is always type str. However, traitvalues can be of arbitrary type. Thus, widgetvalues need to be casted.- Returns:
- callable.