I need to access the id of the pageBlockTable in jQuery to freeze column headers. I'm using plugins developed by others. They basically used HTML table, so referenced the table id directly in the jQuery.
My page outline:
<apex:form id="theform">
<apex:pageBlock id="mainBlock" >
<div class="outPane" id="outPane">
<apex:pageBlockTable value="{!productDetails}" id="productDetails" var="productDetail" >
</apex:pageBlockTable>
</div>
</apex:pageBlock>
</apex:form>
jQuery:
<script type="text/javascript">
var table;
$(document).ready( initializeDataTable());
function initializeDataTable(){
table = $('#productDetails').DataTable({
scrollY: "200px",
scrollX: true,
scrollCollapse: true,
paging: false
});
new $.fn.dataTable.FixedColumns( table, {
leftColumns: 0
} );
}
</script>
Directly using '#productDetails' is not working. I know it should be something like 'theform.mainBlock.outPane.productDetails' but can't figure out the correct way.