I. Overview
1.1 Problem
When the report scrolls horizontally, sometimes we want the title to be always at the center. The effect is as follows. How can we achieve this effect?
1.2 Solution
Use JS to change the grid layout, and then set the left and upper margin.
Note: This method does not support mobile devices.
II. Example
Design the report and drag a great many data columns into the report.
Add a title, merge the heading cells, and adjust the styles.
Click Template -> Web Attributes -> Data Entry Settings, choose to set individually for this template. Add a Loading End event using the following JS:
var $bt=$('td[id^=B1-]'); //Get cell object. B1 is the title cell.
$bt.css('position','fixed'); //Set the position to be fixed.
$bt.css('left',(document.body.clientWidth-$bt.width())/2-$('td[id^=B3-]').width());
//Set the left margin and subtract the width of the frozen column. B3 is the left-most data cell.
$bt.css('top','50px'); //Set upper margin.
Note: This method also applies to the report to be scrolled vertically.
Save and data entry preview, and the effect will be like: