You need to sign in to do that
Don't have an account?
business Identity
How to make a column in DataTable visible/invisible
Hello people!
I need a way to access the column in the apex datatable in javascript, so that I can enable/disable its visibility. I tried the thing with
document.getElementById('{!$Component.emp_bim:emp_frm:crt_emp}').style.display="none";
kind of statements but couldn't get it. In the Below code, I dont want the column 'edit' to be displayed (on some condition of course). Little help here..! Thanks
<apex:dataTable id="emp_dttbl" value="{!emp_lst}" rowClasses="odd,even" var="employee" border="0" cellpadding="5px">
<apex:column >
<apex:facet name="header">Edit</apex:facet>
<apex:image id="emp_udt" alt="{!employee.Id}" height="25px" width="25px" onclick="expandUpdate(this)" url="{!$Resource.update_icon}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Delete</apex:facet>
<apex:image id="emp_del" alt="{!employee.Id}" height="25px" width="25px" onclick="callDelete(this)" url=" {!$Resource.delete_icon}"/>
</apex:column>
</apex:dataTable>
I need a way to access the column in the apex datatable in javascript, so that I can enable/disable its visibility. I tried the thing with
document.getElementById('{!$Component.emp_bim:emp_frm:crt_emp}').style.display="none";
kind of statements but couldn't get it. In the Below code, I dont want the column 'edit' to be displayed (on some condition of course). Little help here..! Thanks
<apex:dataTable id="emp_dttbl" value="{!emp_lst}" rowClasses="odd,even" var="employee" border="0" cellpadding="5px">
<apex:column >
<apex:facet name="header">Edit</apex:facet>
<apex:image id="emp_udt" alt="{!employee.Id}" height="25px" width="25px" onclick="expandUpdate(this)" url="{!$Resource.update_icon}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Delete</apex:facet>
<apex:image id="emp_del" alt="{!employee.Id}" height="25px" width="25px" onclick="callDelete(this)" url=" {!$Resource.delete_icon}"/>
</apex:column>
</apex:dataTable>
Nekosan
Did you try giving styleclass to apex:column and then use document.getElementsByClassName()?
business Identity
Yes Buddy. But its not working that way... :(