dataLoadCoordinator
dataLoadCoordinator
facet is designed for triggering data loaders and for declarative linking of data loaders to data containers, visual components, and view lifecycle events.
Basic Usage
To trigger all data loaders on the view’s BeforeShowEvent
, just add dataLoadCoordinator
with auto="true"
to the view XML descriptor:
<facets>
<dataLoadCoordinator auto="true"/>
</facets>
Working Modes
You can configure dataLoadCoordinator
to work in the automatic, manual or semi-automatic mode.
Automatic Mode
In this mode, dataLoadCoordinator
relies on parameter names with particular prefixes. The prefix denotes a component that produces the parameter value and changes events. If the loader has no parameters in its query text, although it can have parameters in query conditions, it is refreshed on BeforeShowEvent
.
By default, the parameter prefix is container_
for data containers and component_
for visual components. The componentPrefix and containerPrefix attributes allow you to use different prefixes.
Manual Mode
In this mode, the nested refresh elements define when the data loaders must be triggered.
Attributes
You can view and edit facet attributes in Jmix Studio using the Component Inspector panel. |
-
auto
- definesDataLoadCoordinator
working mode. The default value isfalse
.
-
componentPrefix
- defines a prefix for parameters which refer to visual components from whichDataLoadCoordinator
will take parameter values in automatic mode. The default value iscomponent_
.
-
containerPrefix
- defines a prefix for parameters which refer to data containers from whichDataLoadCoordinator
will take parameter values in automatic mode. The default value iscontainer_
.
Refresh Element
The refresh
element allows you to define conditions for when a data loader must be refreshed.
The only attribute of this element is loader
that defines the loader’s id
.
The refresh
element can have the following nested elements defining the triggering conditions:
-
onComponentValueChanged
- to trigger the loader when the value of a visual component is changed. It has the following attributes:-
component
- specifies theid
of the visual component.
-
likeClause
- if you use thelike
expression in query condition, you can define one of three possible search modes:-
NONE
- the default value. -
CASE_SENSITIVE
- uppercase and lowercase letters are treated as distinct. -
CASE_INSENSITIVE
- uppercase and lowercase letters are treated as equivalent.
-
-
param
- specifies the query parameter name.
-
-
onContainerItemChanged
- to trigger the loader when the current item in a data container is changed. It has the following attributes:-
container
- specifies theid
of the data container.
-
param
- specifies the query parameter name.
-
-
onViewEvent
- to trigger the loader on a view lifecycle event. It has the following attribute:-
type
- defines the type of the view event. Possible values:-
Init
- to trigger onInitEvent
. -
BeforeShow
- to trigger onBeforeShowEvent
. -
Ready
- to trigger onReadyEvent
.
-
-