How To Repeat Header Using Script

In v7 only Group Header can ‘Repeat Header’. In this sample we will demonstrate on how scripting can be used in report template to ‘Repeat Header’ on Data Grid and HBox Element.

Steps taken:

  1. Consider the number of row a page can contain. (Example: 10 records in 1 page)
  2. In ‘Function Definitions’ declare the record count:Example:
    var rowCnt = 0;
  3. Insert a dummy Header which you want to repeat.
  4. In the data, this script will count the rows while rendering.Example:
    HBox:On Render End -
    rowCnt++;
  5. In the dummy Header, Render If record count is 10, 20Example:
    HBox:Render If -
    rowCnt == 10 || rowCnt == 20; //this will indicate on which row the dummy Hbox header will appear. For this case it will appear on rows 11 and 21 respectively
  6. In the dummy Header, set the visible to true when it is rendered.Example:
    HBox:On Render Begin -
    this.setVisible(true);

To download the necessary files for this recipe, refer to the attached ZIP file.
HowToRepeatHeaderUsingScript.zip (4.7 KB)