Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330307

Summary: Hiding column code in onRender of Table not working on Fedora
Product: z_Archived Reporter: ankit <ankitvariousbugzilla>
Component: BIRTAssignee: Jianchao Li <jianchao.li>
Status: RESOLVED WORKSFORME QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, jianchao.li
Version: unspecified   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
rptdesign file containing the test code none

Description ankit CLA 2010-11-16 02:03:02 EST
Build Identifier: M20100211-1343

My columns in the display list are based on selections from a parameter list, So i created a layout that includes all the columns and drop the ones that I don't need based on the parameter. 

I coded the example, see attachment [hideColumnBasedOnParameter.rptdesign]
But when I tried to run this using the preview mode of eclipse and birt web viewer . The columns were not hidden

Although, as i had put in log statements to look at column visibility settings after the "hiding code" in onRender method of table. These log statements output correct display property (i.e the columns that should be displayed have property as 'block' and the one's which should not be displayed have value as 'none'). 

Below are the specifications of BIRT for my machine [Fedora 12].
Viewer Version : 2.6.1
Engine Version: 2.6.1
JRE version: 1.6.0_21

After consulting on the forums (and some experimenting) i found that this code works on Windows machine, but fails in Fedora (probably other linux machines too)

Following is the analysis of the tests carried out by me
So test cases 
1) IDE : Eclipse galileo  
OS : Fedora 13 (32 bit)
Birt version : 2.6.1

2) IDE: Eclipse helios SR1
OS : Fedora 13 (32 bit)
Birt version : 2.6.1

3) IDE: Eclipse helios SR1
OS : Windows 7
Birt version : 2.6.1

So for cases 1 and 2 the code did not work, but for the 3rd case, it worked.




Reproducible: Always

Steps to Reproduce:
Case 1 : Fedora 12
1. Use the attached rptdesign on a fresh installation of Eclipse galileo  or Eclipse helios SR1
2. Use the preview mode of BIRT and select some parameters from the dropdown list of the report parameters
3. The resultant preview would contain all the columns irrespective of whether this column was selected from the dropdown

Case 2 : Windows
1. Use the attached rptdesign on a fresh installation of Eclipse galileo  or Eclipse helios SR1
2. Use the preview mode of BIRT and select some parameters from the dropdown list of the report parameters
3. The resultant preview would only contain columns which were selected from the dropdown.
Comment 1 ankit CLA 2010-11-16 02:04:36 EST
Created attachment 183186 [details]
rptdesign file containing the test code

rptdesign file containing the test code
Comment 3 Jianchao Li CLA 2011-07-21 22:16:41 EDT
Use "visibility:collapse" to hide the table column and remove the space it takes. It works in Firefox and IE(8.0, 9.0). The "*display:none" attribute is to make the column hidden in previous IE versions including IE7.
So that combine of these two attributes will hide the table columns perfectly in all Firefox and IE versions.
Comment 4 Jianchao Li CLA 2011-07-27 22:17:26 EDT
Reopen this issue because of an regression issue that more columns are hidden by mistake.
Comment 5 Jianchao Li CLA 2011-07-27 22:18:40 EDT
This reason for this issue is that the detail cells' styles are not set as "display:none" at render time, which should inherit from it's parent(the column element) at design time.
To solve this issue, please use the following script in the onPrepare method of the table:
cCount=this.getColumnCount();
i=0;
j=0;
isChosen="";
paramVal=params["paramSelectList"].value;
paramLength=params["paramSelectList"].length;
while(i<cCount){
    while(j<paramLength){
            if (this.getDataBindings()[i].name == paramVal[j].toUpperCase())
            {
                isChosen = "yes";
            }
            else
            {
                if (isChosen == "yes"){
                    isChosen = isChosen;
                }
                else{
                    isChosen = "no";
                }
            }
            j++;
    }
    if (isChosen == "yes"){
        this.getColumn(i).getStyle().display = "block";
    }
    else{
        this.getColumn(i).getStyle().display = "none";
    }
    j=0;
    i++;
    isChosen = "";
}