Defaults to TreeTableCfg
. Type of the configuration object for this widget.
Creates a new instance of this widget. Please note that you should NOT override this constructor. Instead, override the init method, which is called at the end of the constructor once the instance is created.
The widget configuration to be used for this widget
instance. This widget configuration is usually created on the server by the javax.faces.render.Renderer
for
this component.
Map between the sort order names and the multiplier for the comparator.
Localized message for sorting items in ascending order.
The DOM element for the main TABLE element.
The configuration of this widget instance. Please note that
no property is guaranteed to be present, you should always check for undefined
before accessing a property.
This is partly because the value of a property is not transmitted from the server to the client when it equals
the default.
The DOM element for the clone of the table head.
Whether the width of all columns needs to stay fixed.
DOM element of the table cell for which the context menu was opened, set by the data table.
The DOM element for the currently selected cell, when using inline editing.
The DOM element for the row at the cursor position, used for selecting multiple rows when holding the shift key.
Localized message for sorting items in descending order.
Array of registered listeners invoked when this widget is destroyed. You should normally not use modify this directly, use addDestroyListener instead.
The set-timeout timer ID for the timer used for the delay during filtering.
The DOM element for the TD columns in the table footer.
The DOM element for the TABLE element of the footer.
The DOM element for the TH columns in the header.
The DOM element for the TABLE element of the header.
The client-side ID of this widget, with all parent naming containers, such as
myForm:myWidget
. This is also the ID of the container HTML element for this widget. In case the widget needs
multiple container elements (such as Paginator), this may also be an array if IDs.
The jQuery instance of the container element of this widget. In case id is an array, it will contain multiple elements. Please note that some widgets have got not DOM elements at all, in this case this will be an empty jQuery instance.
A CSS selector for the container element (or elements, in case id is an array) of
this widget, This is usually an ID selector (that is properly escaped). You can select the container element or
elements like this: $(widget.jqId)
.
The DOM element for the hidden input storing the selected rows.
CSS unit for the right margin of this tree table, determined from the scrollbar width.
Localized message for displaying the rows unsorted.
The paginator widget instance used for filtering.
Whether the scroll height was specified in percent.
Whether the scroll width was specified in percent.
Array of registered listeners invoked when this widget is refreshed. You should normally not use modify this directly, use addRefreshListener instead.
The height of the visible scroll area relative to the total height of this tree table.
Array storing the current widths for each resizable column.
INPUT element storing the current widths for each resizable column.
The set-timeout timer ID of the timer used for resizing.
The DOM element for the draggable handle for resizing columns.
The DOM element for the scrollable DIV with the body table.
The DOM element for the scrollable DIV with the footer table.
The DOM element for the container DIV of the footer table.
The DOM element for the scrollable DIV with the header table.
The DOM element for the container DIV of the header table.
The DOM element for the hidden input storing the current scroll position.
The value of the scrollStateHolder.
A list of row keys of the currently selected rows.
List of criteria by which to filter this table.
The DOM elements for the list of sortable columns.
The DOM element for the container with the sticky header.
The DOM element for the table body of this tree table.
The DOM element for the table header of this tree table.
The DOM element for the clone of the table header.
The name of the widget variables of this widget. The widget variable can be used to
access a widget instance by calling PF('myWidgetVar')
.
This render method is called by this deferred widget once the widget container has become visible. You may now proceed with widget initialization.
Must be overridden, or an error will be thrown.
Adds a deferred rendering task for the given widget to the queue.
The ID of a deferred widget.
The container element that should be visible.
Callback that is invoked when the widget may possibly have become visible.
Should return true
when the widget was rendered, or false
when the widget still needs to be rendered
later.
Lets you register a listener that is called before the component is destroyed.
When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered content. When the element is removed from the DOM by the update, the DOM element is detached from the DOM and all destroy listeners are called. This makes it possible to add listeners from outside the widget code.
If you call this method twice with the same listener, it will be registered twice and later also called twice.
Note that for this to work, you must not override the destroy
method; or if you do, call super
.
Also, after this widget was detached is done, all destroy listeners will be unregistered.
A destroy listener to be registered.
When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, all refresh listeners are called. This makes it possible to add listeners from outside the widget code.
If you call this method twice with the same listener, it will be registered twice and later also called twice.
Note that for this to work, you must not override the refresh
method; or if you do, call super
.
Also, after the refresh is done, all refresh listeners will be deregistered. If you added the listeners from
within this widget, consider adding the refresh listeners not only in the init
method, but also again in
the refresh
method after calling super
.
A refresh listener to be registered.
Adds the given sorting to the list of sortings. Each sorting describes a column by which to sort. This data table may be sorted by multiple columns.
Sorting to add.
Adds the given row to the list of currently selected rows.
A row that was selected.
Adjust the view and scrolling position for the current height of the table.
Adjust the view and scrolling position for the current width of the table.
Aligns the scroll body element, taking into account the width of the scrollbar.
Sets the height of the scroll body to the value of this widget's configuration.
Sets up the event listeners required for filtering this tree table when the filter input has changed.
The filter input field.
Sets up the 'search' event which for HTML5 text search fields handles the clear 'x' button.
INPUT element of the text filter.
Callback that is invoked when the context menu is initialized. Lets the context menu provider register the appropriate event listeners for when the context menu should be shown and hidden.
The widget instance of the context menu.
The widget instance of the target widget that wants to add a context menu.
ID selector or DOM element of the target, i.e. the element the context menu belongs to.
The current configuration of the context menu.
Sets up all events listeners required for editing entire rows or individual cells.
Sets up the event listeners required for filtering this tree table when the enter key is pressed.
The filter input field.
Sets up all event listeners that are required by this widget.
Sets up the event listeners required for filtering this tree table.
The filter input field.
Sets up all events listeners required for selecting one or multiple rows of this tree table.
Sets up all events listeners required for sorting the rows of this tree table.
Sets up the event listeners required for filtering this tree table, filtering either when enter is pressed or when the configured event occurs.
The filter input field.
Each widget may have one or several behaviors attached to it. This method calls all attached behaviors for the given event name. In case no such behavior exists, this method does nothing and returns immediately.
A behavior is a way for associating client-side scripts with UI components that opens all sorts of possibilities, including client-side validation, DOM and style manipulation, keyboard handling, and more. When the behavior is triggered, the configured JavaScript gets executed.
Behaviors are often, but not necessarily, AJAX behavior. When triggered, it initiates a request the server
and processes the response once it is received. This enables several features such as updating or replacing
elements dynamically. You can add an AJAX behavior via
<p:ajax event="name" actionListener="#{...}" onstart="..." />
.
The name of an event to call.
Additional configuration that is passed to the AJAX request for the server-side callback.
When a row is currently being edited: cancels row editing and discards the entered data.
A row for which to cancel editing, must be a TR element.
When activating the inline editor of a cell, starts an AJAX request to fetch the editor's HTML. Also invokes the appropriate behaviors.
The cell for which inline editing should be activated.
Clear the filter input of this tree table and shows all rows again.
Creates and stores a cloned copy of the table head(er), and sets up some event handlers.
Collapses the given row of this tree table.
A node to collapse, must be a TR element.
Collapses the given row of this tree table after saving the contents of an inline editor.
A row to collapse.
Cleans up deferred render tasks. When you extend this class and override this method, make sure to call
super
.
When the inline editor a cell is active and the user requests a cancel: discards the data and loads the original content of the cell.
The cell for which editing should be canceled.
When the inline editor a cell is active and the user wants to save the changes: send the newly entered data to the server and hide the editor.
The cell with an inline editor to be saved.
Sends an AJAX request to the server to handle a row save or cancel event.
The inline editor with data that needs to be saved or discarded.
The action to perform, either save
or cancel
.
Expands the given row of this tree table.
A node to expand, must be a TR element.
Reads the current value of the filter input and performs a filtering operation. Sends an AJAX requests to the server and updates this tree table with the result. Also invokes the appropriate behaviors.
Finds the saved width of the given column. The width of resizable columns may be saved to restore it after an AJAX update.
ID of a column
The saved width of the given column in pixels. null
when the given column does not
exist.
Sends a select event on server side to invoke a select listener if defined.
The key of the node that was selected.
Name of the event to fire.
Optional callback function invoked when the menu was opened.
Callback for when a node was selected. Invokes the appropriate behaviors.
Key of the row that was selected.
Callback for when a node was unselected. Invokes the appropriate behaviors.
Key of the row that was unselected.
Applies the desired width to all columns.
Each widget may have one or several behaviors attached to it. This method returns the callback function for the given event.
Note: Do not call the method directly, the recommended way to invoke a behavior is via callBehavior.
A behavior is a way for associating client-side scripts with UI components that opens all sorts of possibilities, including client-side validation, DOM and style manipulation, keyboard handling, and more. When the behavior is triggered, the configured JavaScript gets executed.
Behaviors are often, but not necessarily, AJAX behavior. When triggered, it initiates a request the server
and processes the response once it is received. This enables several features such as updating or replacing
elements dynamically. You can add an AJAX behavior via
<p:ajax event="name" actionListener="#{...}" onstart="..." />
.
The name of an event for which to retrieve the behavior.
The behavior with the given name, or null
if no such behavior
exists.
Retrieves the meta data of the given cell.
A cell to inspect.
The meta data for the given cell.
Each widget has got a container element, this method returns that container. This container element is usually also the element whose ID is the client-side ID of the JSF component.
The jQuery instance representing the main HTML container element of this widget.
Returns the paginator instance if any is exists.
The paginator instance for this widget, or undefined
if
paging is not enabled.
Gets the closest parent form for this widget.
A JQuery instance that either contains the form when found, or an empty JQuery instance when the form could not be found.
Gets the closest parent form ID for this widget lazily so it can be used in AJAX requests.
Either the form ID or undefined
if no form can be found.
Attempts to find a width for the scrollbar of the browser.
An estimate in pixels for the width of the native scrollbar.
Creates the sort order message shown to indicate what the current sort order is.
Optional label text from an aria attribute.
Sort order message.
The sort order message to use.
Handles a pagination event by updating this tree table and invoking the appropriate behaviors.
The new pagination state to apply.
Each widget may have one or several behaviors attached to it. This method checks whether this widget has got at least one behavior associated with given event name.
A behavior is a way for associating client-side scripts with UI components that opens all sorts of possibilities, including client-side validation, DOM and style manipulation, keyboard handling, and more. When the behavior is triggered, the configured JavaScript gets executed.
Behaviors are often, but not necessarily, AJAX behavior. When triggered, it initiates a request the server
and processes the response once it is received. This enables several features such as updating or replacing
elements dynamically. You can add an AJAX behavior via
<p:ajax event="name" actionListener="#{...}" onstart="..." />
.
The name of an event to check.
true
if this widget has the given behavior, false
otherwise.
Checks if there is any vertical overflow present currently.
true
if there is overflow in the vertical y direction, or false
otherwise.
Sets the indeterminate
attribute of the given rows to true
.
List of rows to process.
A widget class should not declare an explicit constructor, the default constructor provided by this base widget should be used. Instead, override this initialize method which is called after the widget instance was constructed. You can use this method to perform any initialization that is required. For widgets that need to create custom HTML on the client-side this is also the place where you should call your render method.
Please make sure to call the super method first before adding your own custom logic to the init method:
PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
init: function(cfg) {
this._super(cfg);
// custom initialization
}
});
The widget configuration to be used for this widget instance.
This widget configuration is usually created on the server by the javax.faces.render.Renderer
for this
component.
Callback for when validation did not succeed. Switches all editors of the given row to the error state.
the rowKey.
Checks whether rows of this tree table are selected via checkboxes.
true
if the TreeTableCfg.selectionMode is set to checkbox
, or false
otherwise.
Checks if this widget is detached, ie whether the HTML element of this widget is currently contained within the DOM (the HTML body element). A widget may become detached during an AJAX update, and it may remain detached in case the update removed this component from the component tree.
true
if this widget is currently detached, or false
otherwise.
Checks whether any data is currently displayed.
Whether there is any data displayed currently.
Checks whether multiple rows of this tree table may be selected.
true
if the TreeTableCfg.selectionMode is set to multiple
, or false
otherwise.
Checks whether the given row is currently selected.
Key of a row to check.
Whether the given row is selected.
Checks whether only a single row of this tree table can be selected via clicking.
true
if the TreeTableCfg.selectionMode is set to single
, or false
otherwise.
Serializes the option from the sort meta items.
Property of the sort meta to use.
All values from the current sort meta list for the given option.
Callback for when a row was clicked. Selects or unselects the row, if that feature is enabled.
The click event that occurred.
The node that was clicked.
Callback for when a right click was performed on a node. Selects or unselects the row, if that feature is enabled.
The click event that occurred.
The node that was clicked.
Optional callback function invoked when the menu was opened.
true to hide the native browser context menu, false to display it
Called after the widget has become visible and after it was rendered. May be overridden, the default implementation is a no-op.
Propagates a select or unselect event up to the parents of the given row.
A node that was selected or unselected.
Removes the cloned table header and create a new clone.
Used in ajax updates, reloads the widget configuration.
When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this method is called with the new widget configuration from the server. This makes it possible to persist client-side state during an update, such as the currently selected tab.
Please note that instead of overriding this method, you should consider adding a refresh listener instead via addRefreshListener. This has the advantage of letting you add multiple listeners, and makes it possible to add additional listeners from code outside this widget.
By default, this method calls all refresh listeners, then reinitializes the widget by calling the init
method.
The new widget configuration from the server.
The value as returned by the init
method, which is often undefined
.
Removes all children of the given row from the list of currently selected rows.
A row with children that were unselected.
Removes the widget's script block from the DOM. Currently, the ID of this script block consists of the
client-side ID of this widget with the prefix _s
, but this is subject to change.
The client-side ID of the widget.
Removes the given row from the list of currenlty selected rows.
A row that was unselected.
This render method to check whether the widget container is visible. Do not override this method, or the deferred widget functionality may not work properly anymore.
true
if the widget container is visible, false
or
undefined
otherwise.
Callback for when a row was resized. Adjust the column widths.
Event that triggered the resize.
Details about the resize.
Reads the scroll position from the hidden input element and applies it.
Saves the current data entered into a cell's inline editor. Checks whether the data has changed and if so, sends it to the server.
A cell with an inline editor to save.
When a row is currently being edited: Saves the edited row and hides the editors.
A row to save, must be a TR element.
Stores the current scroll position in a hidden input element.
Selects the given row. The TreeTableCfg.selectionMode must not be set to checkbox
.
A row to select, must be a TR element.
If set to true
, does not trigger event listeners.
Selects all rows between the current row and the row that was just clicked. Used for multiple selections while the shift key is pressed.
A row that was just clicked.
Applies the appropriated width to all given column elements.
A list of column elements.
Applies the given outer width to an element.
An element to modify.
The new (outer) width for the element.
Adjust the view for the given scrollbar width.
The width of the scrollbar.
Sets up all event listeners required for the standard filters. Also skins the filter inputs.
Sets up the JQuery UI draggable with the appropriate event listeners for resizing columns.
Initializes scrolling and sets up the appropriate event handlers.
Sets up the CSS and event listeners for the sticky header feature, if it is enabled.
Checks whether the tree table should be sorted.
Event that occurred.
Column that was clicked.
Whether the tree table should be sorted.
Activates the inline editor for the given cell.
The cell TD element for which to activate the inline editor.
Makes the inline cell visible and sets up the appropriate event listeners.
The cell TD element for which to activate inline editing mode.
Hides the row and display the row editors.
A row for which to show the editors.
Sort this tree table by the given column, either in ascending or descending order.
A column to sort by, must be a TH element of the THEAD.
Whether to sort the rows in ascending or descending order.
true
if sorting by multiple columns is enabled, or false
otherwise.
Switches a row to edit mode and displays the editors for that row.
A row for which to activate the editors. Must be a TR element.
Callback for when the tab key is pressed, switches (focuses) to the next or previous cell editor.
The currently focused cell.
true
to move to the next cell, or false
to move to the previous cell.
When the TreeTableCfg.selectionMode is set to checkbox
: select the given row if is is currently
unselected, or unselects it otherwise.
A row to toggle, must be a TR element.
Unselects all selected rows. The TreeTableCfg.selectionMode must not be set to checkbox
.
Unselects the given row. The TreeTableCfg.selectionMode must not be set to checkbox
.
A row to unselect, must be a TR element.
If set to true
, does not trigger event listeners.
Computes and saves the resizable state of this data table, ie. which columns have got which width. May be used later to restore the current column width after an AJAX update.
Element of a column header of this data table.
Element of the column header next to the given column header.
The element for this data table.
New width to be applied.
Width of the column next to the given column header.
In multi-sort mode this will add number indicators to let the user know the current sort order. If only one column is sorted then no indicator is displayed and will only be displayed once more than one column is sorted.
Updates the vertical scroll position and adjusts the margin.
Switch from edit mode to view mode, Hides the inline editor and displays the data.
The cell with an activate inline editor to hide.
Saves the currently selected rows in the hidden input field.
Generated using TypeDoc
PrimeFaces TreeTable Widget
TreeTable is is used for displaying hierarchical data in tabular format.