I'm trying to hide and show an entire column in a table depending on if a user has pressed a checkbox or not. Hiding the elements is easy, but showing them again later is a problem. I want them to be displayed exactly as they were before I hide them but thats not the case.
When I show the elements They are shown in a similar fashion (note that it doesn't add the rowspan, but thats how its displayed).
Edit Also the below table is an example and is not the real table, its just for explaining purpose.
<TABLE BORDER=2 CELLPADDING=4>
<TR>
<TH ROWSPAN=6 BGCOLOR="#99CCFF">Production</TH>
<TD>Raha Mutisya</TD>
</TR>
<TR>
<TD>Shalom Buraka</TD>
</TR>
<TR>
<TD>Brandy Davis</TD>
</TR>
<TR>
<TD>Claire Horne</TD>
</TR>
<TR>
<TD>Bruce Eckel</TD>
</TR>
<TR>
<TD>Danny Zeman</TD>
</TR>
</TABLE>
And I want it to show in its original fashion like below.
<TABLE BORDER=2 CELLPADDING=4>
<TR>
<TH BGCOLOR="#99CCFF">Production</TH>
<TD>Raha Mutisya</TD>
<TD>Shalom Buraka</TD>
<TD>Brandy Davis</TD>
<TD>Claire Horne</TD>
<TD>Bruce Eckel</TD>
<TD>Danny Zeman</TD>
</TR>
</TABLE>
So my question is what "display" property should I use in this case? I have tested many of them but none suited my situation.
Below is the javascript code.
$("#officialCheckBox").click(function() {
if(this.checked && dataCol.Official ==="False"){
table.setBodyColumnCss(column + 1, "hide_class");
}
else{
table.setBodyColumnCss(column,"show_class");
}
});
table.setBodyColumnCss(column,"show_class");
this.setBodyColumnCss = function(col,css){
col_css[col] = css;
this.table_body.find("td[col=" +col+ "]").addClass(css);
};
And the css classes.
.hide_class{
display: none;
}
.show_class{
display: inherit;
}