MicroStrategy ONE

Displaying the Column Headers

This example demonstrates how to display the column headers.

Code sample

1. WebGridHeaders colHeaders = reportGrid.getColumnHeaders();
 

2.  for (int i=0; i < colHeaders.size(); i++){

3.   WebHeaders colElements = colHeaders.get(i);

4.   for (int j=0; j < colElements.size(); j++){

5.    WebHeader colElement = colElements.get(j);

6.    int colSpan = colElement.getColSpan();

7.    int rowSpan = colElement.getRowSpan();

8.    int depth = colElement.getDepth();

9.    WebElement webElement = colElement.getWebElement();

 

// using the attributes, generate the HTML to display them.

…HTML code…
 

10.  }

11. }

Explanation

Line 1 gets the column headers from the WebReportGrid object. Lines 2-8 iterate through all the WebHeader objects. Line 9 gets the WebElement object that provides information about the elementID and the name of the display. Line 9 onwards generates the HTML for displaying the grid using all the attributes obtained.