new (require("nmodule/webEditors/rc/wb/table/Table"))(params)
API Status: Development
Table widget.
It supports the following bajaux
Properties
:
fixedHeaders
: (boolean) set to true to allow scrolling the table body
up and down while the headers remain fixed. This will only make sense
when the table widget is instantiated in a block-level element, like adiv
, whose dimensions are constrained.hideUnseenColumns
: (boolean) set tofalse
to cause columns with theUNSEEN
flag to always be shown. Defaults totrue
(unseen columns are
hidden by default).
Extends:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
Methods
-
applyParams( [params])
-
Can re-apply certain params that can also be passed to the constructor.
Parameters:
Name Type Argument Description params
Object <optional>
Properties
Name Type Argument Default Description readonly
Boolean <optional>
enabled
Boolean <optional>
true must explicitly set to false to
disableproperties
module:bajaux/Properties | Object <optional>
- Inherited From:
Returns:
promise to be resolved after any
setEnabled
/setReadonly
work is done. Note that these functions will not
be called if the value ofenabled
/readonly
is not actually changing.- Type
- Promise
-
destroy()
-
Removes the
editor
class and emits adestroyed
tinyevent.- Inherited From:
Returns:
call to module:bajaux/Widget#destroy
- Type
- Promise
-
doDestroy()
-
Remove
TableWidget
class and event handlers from the loaded table model. -
doInitialize(dom, params)
-
Initialize the HTML table, creating
thead
,tbody
, andtfoot
elements.Parameters:
Name Type Description dom
JQuery params
Object optional initialization parameters
-
doLoad(tableModel)
-
Load in a
TableModel
, immediately rendering all columns and rows. Event
handlers will be registered to listen for updates to the table model.Parameters:
Name Type Description tableModel
module:nmodule/webEditors/rc/wb/table/model/TableModel Throws:
-
if no TableModel provided
- Type
- Error
Returns:
- Type
- Promise
-
-
generateId()
-
Generate a unique DOM ID. The ID will include the name of this editor's
constructor just for tracing/debugging purposes.- Inherited From:
Returns:
- Type
- String
-
getChildWidgets( [params])
-
Returns an array of child widgets living inside this editor's DOM.
This method will specifically not return child widgets of child widgets- for instance, if this widget has one child editor for a
baja.Facets
,
you will only get a single widget back - it won't recurse down and give
you all the tag editors, type editors etc.
This is safer and easier than using
$.find()
, which recurses down,
or carefully managing strings of$.children()
calls.Pass in a
jQuery
instance to limit the child editor search to
a particular set of elements. Otherwise, will search all child elements
of this editor's DOM.If this editor has not initialized yet, you'll just get an empty array
back.The returned array will have some utility functions attached that return
promises. See example for details.Parameters:
Name Type Argument Description params
Object | jQuery <optional>
Properties
Name Type Argument Default Description dom
jQuery <optional>
this.jq().children() the dom element to search
type
function <optional>
the widget type to search for - pass in the
actual constructor, forinstanceof
checks- Inherited From:
Returns:
an array
of child editors- Type
- Array.<module:nmodule/webEditors/rc/fe/BaseWidget>
Examples
var kids = ed.getChildEditors(); kids.setAllEnabled(false).then(function () {}); kids.setAllModified(false).then(function () {}); kids.setAllReadonly(false).then(function () {}); kids.readAll().then(function (valuesArray) {}); kids.validateAll().then(function (valuesArray) {}); kids.saveAll().then(function () {}); kids.destroyAll().then(function () {});
var stringEditors = ed.getChildEditors({ type: StringEditor });
- for instance, if this widget has one child editor for a
-
getModel()
-
Get the currently loaded
TableModel
.- Since:
-
- Niagara 4.6
Returns:
-
getSelectedRows()
-
Get all rows which are currently selected by the user.
- Since:
-
- Niagara 4.6
Returns:
- Type
- Array.<module:nmodule/webEditors/rc/wb/table/model/Row>
-
getSubject(elem)
-
When showing a context menu, will decide which values in the TableModel are
the targets of the right-click operation.If the row being right-clicked is not already selected, then the subject of
the correspondingRow
will be used to show the context menu.If the row being right-clicked is already selected, then the subjects of
all selectedRow
s will be used.Parameters:
Name Type Description elem
JQuery Returns:
array containing the subjects of the rows being
right-clicked. Can return an empty array if no rows are present.- Type
- Array.<*>
-
initialize(dom)
-
Every
BaseWidget
will add theeditor
class to the element and emit aninitialized
tinyevent when initialized.Parameters:
Name Type Description dom
JQuery - Inherited From:
Returns:
call to module:bajaux/Widget#initialize
- Type
- Promise
-
load(value [, params])
-
Will emit a
loaded
tinyevent.Parameters:
Name Type Argument Description value
* params
Object <optional>
- Inherited From:
Returns:
call to module:bajaux/Widget#load
- Type
- Promise
-
requestFocus()
-
Attempts to place the cursor focus on this editor. For instance, if
showing a simple string editor in a dialog, it should request focus so
that the user can simply begin typing without having to move the mouse
over to it and click.Override this as necessary; by default, will place focus on the first
input
ortextarea
element in this editor's element.- Inherited From:
-
shouldValidate( [flag])
-
This provides an extra hook for an editor to declare itself as needing to
be validated before saving or not. The default behavior is to return true
if this editor is modified, or if ashouldValidate
bajaux
Property
is present and truthy. If neither of these conditions is true, it will
check all known child editors, and return true if it has a child editor
that should validate.If
flag
is given, then the check against theshouldValidate
Property
will return true only if the value bitwise matches the
parameter. SeeBaseWidget.SHOULD_VALIDATE_ON_SAVE
, etc.Parameters:
Name Type Argument Description flag
Number <optional>
- Inherited From:
Returns:
- Type
- Boolean