+ Start a Discussion
rgaither5488rgaither5488 

Hiding a Pageblocktable with the press of a button

I'm using this javascript to collapse a pageBlocktable in Visualforce and it works great in all browsers but IE.  Does anyone know of something I could do to fix that issue.  Here is my code:

 

<script>

var contentArray = new Array();

var idArray = new Array();

var isCollapsed = false;

 

function collapse(ids){

if (isCollapsed) {

fix();

return;

}

isCollapsed = true;

idArray = ids.split(',');

for (var i = 0; i < idArray.length; i++) {

contentArray[i] = document.getElementById(idArray[i]).innerHTML;

document.getElementById(idArray[i]).innerHTML = '';

}

}

 

function fix(){

isCollapsed = false;

for (var i = 0; i < idArray.length; i++) {

document.getElementById(idArray[i]).innerHTML = contentArray[i];

}

}

</script>

Best Answer chosen by Admin (Salesforce Developers) 
NaishadhNaishadh

you innerHTML issue is a well know bug for IE

 

http://stud3.tuwien.ac.at/~e0226430/innerHtmlQuirk.html

All Answers

NaishadhNaishadh

You can also try by putting your pageblocktable inside outputpanel and simply use div enable disable property.

rgaither5488rgaither5488

I can see how that could work, and I may have to switch to that solution, but I would like to keep it in javascript...and I was hoping to find a hack for IE that could get my functions to work.  I had one in there at first but it wasn't doing anything so I was hoping someone could guide me in the right direction.

NaishadhNaishadh

you innerHTML issue is a well know bug for IE

 

http://stud3.tuwien.ac.at/~e0226430/innerHtmlQuirk.html

This was selected as the best answer