| | | | Browse by category |
Question
How to add a vertical scrollbar to Gantt table in thinclient application?
Answer
By default, JViews Gantt Table has a horizonal scroll bar. You can add a vertical scroll bar to the Gantt Table as well. A possible approach is using JavaScript on the DHTML thin client.
var tableView = chartView.getTableView();
var verticalscrollbar = new IlvVScrollbar(chartLeft-15, tableView.getTop(), tableView.getHeight());
verticalscrollbar._ganttView = chartView;
verticalscrollbar._tableView = tableView;
verticalscrollbar.setVisible(true);
verticalscrollbar.toHTML();
//This queries a new image from the server
//when the value of the vertical scrollbar has changed.
var tableVertScrollListener = function() {
var position = verticalscrollbar.getValue();
chartView.setVerticalScrollPosition(position);
chartView.updateImage();
};
verticalscrollbar.addValueListener(tableVertScrollListener);
To synchronize the scrollbar"s height with the Gantt Chart, add a SizeListener to the IlvGanttView and adjust the bounds of the scrollbar accordingly.
The attached index.html contains all the codes mentioned above. Simply replace the samplesservletwebpagesindex.html
with this and rebuild the servlet
sample.
Note: Starting with version 8.7, the Gantt sheet supports horizontal and vertical scroll bars in both JSF components and thin-client.
In JSF components, the scroll bars can be enabled or disabled using the sheetHScrollable
and sheetVScrollable
attribute of the jvgf:ganttView
and jvgf:scheduleView
tag.
In thin client, the scroll bars can be enabled or disabled using the IlvGanttView.setSheetHScrollable(scrollable)
and IlvGanttView.setSheetVScrollable(scrollable)