JavaScript objects
Each time a JViews Gantt JSF component is created, a corresponding JavaScript object is also created. You can access this object through a global JavaScript variable whose name is the same as the id attribute of the tag. For example, the tag:
<jvgf:ganttView id="gantt" [...] />
will be rendered as the following JavaScript code:
gantt = new IlvHierarchyChartViewProxy ('gantt',' ...);
NOTE See the documentation of the Java API of each renderer to know which JavaScript proxy will be generated for this component.
You can modify the object locally by using a set of methods attached to this object. For further information about available JavaScript objects, see
Javascript API.
For example, the following code defines two buttons that install respectively a scroll interactor and a row expand or collapse interactor on the table of a
ganttView.
<jv:imageButton [...] onclick="gantt.setTableInteractor(tableScrollInteractor)" />
<jv:imageButton [...] onclick="gantt.setTableInteractor(tableExpandInteractor)" />
<jvgf:ganttView id="gantt" [...] />
At rendering time, an
IlvHierarchyChartViewProxy JavaScript object is created that is accessible through the
gantt JavaScript variable. Then, since
rowExpandCollapseInteractor and
tableScrollInteractor JavaScript objects have been created in the same way, you can directly set one of these interactors with the
setInteractor method.
It is possible to set the interactor of the table and the sheet views in one call:
<jv:imageButton [...]
onclick="gantt.setInteractors(tableScrollInteractor, sheetScrollInteractor)" />
Additionally, the behavior of these JavaScript objects is to keep their state, so that if a submit request is issued, the state of the object is sent to the server. This behavior makes sure that the client and the server remain coherent.
For further information about available JavaScript objects, see
Javascript API, the JavaScript API reference documentation of
JViews Gantt.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.