Can FixedHeader and FixedColumns be used together on one page?
Can FixedHeader and FixedColumns be used together on one page?
Hi,
I would like to know if FixedHeader and FixedColumns can be used together on one page?
My datatable columns is dynamic and it can be null sometimes. I need the datatable header to stay and the first 2 columns to be fixed.
For the FixedHeader, I managed to do this.
var oTable1 = document.getElementById('ca1004_datatable_balance');
if(oTable1 != null){
new FixedHeader( oTable1 );
}
For the FixedColumns, I do this. But I get this error "Uncaught TypeError: Cannot read property 'aoColumns' of null"
var oTable = jq('#ca1004_datatable_balance').dataTable( {
"sScrollX": "100%",
"sScrollXInner": "140%",
"bScrollCollapse": true
});
new FixedColumns( oTable, {
"iLeftColumns": 2,
"iLeftWidth": 350
} );
Any better ideas how can I achieve this? I am using FixedHeader 2.0.6 and FixedColumns 2.0.3.
This question has an accepted answers - jump to answer
Answers
They can be used on the same page, but they cannot be used on the same table. They are, so some extent, trying to solve the same problem - the header being visible. So the overlap in functionality is why I've not yet spent the time getting them to work together. I will at some point, but haven't had the chance yet.
Allan
Hi allan,
Noted. I am looking at this http://datatables.net/release-datatables/extensions/FixedColumns/examples/two_columns.html
What need to be done to fixed this error "Uncaught TypeError: Cannot read property 'aoColumns' of null"?
Could you advise me?
It might be that you are using an old version of FixedColumns possibly... If you haven't already, I'd suggest updating your DataTables and FixedColumns to the latest software.
If that doesn't resolve the issue, can you link us to the page showing the issue.
Thanks,
Allan
Hi allan,
I have download the latest to try. Would like to check, does it work with Primefaces datatable?
No idea! What is Primefaces datatable?
Allan
Hi allan,
Actually it is a JSF datatable. As I can see from the examples, it works with
<
table>. However, I would like to apply to <p:dataTable>. Just not too sure if that works.
Btw, how can I overcome this error? "Uncaught TypeError: Cannot read property 'aoColumns' of null". My dataTable will be null sometimes.
Assuming
<p:dataTable>
outputs a table that meets the DataTables requirements, then it will work okay. If you are seeing an error, please link to a test case showing the error, as per the forum rules.Allan