iowatiger08
iowatiger08

Reputation: 1962

fixed columns on datatable

I have a portlet view jsp that I am trying to fix the left two columns along with the headers using dataTables and the FixedColumns plugin for a pivot table.

I get the header row to fix and to be able to scroll the Y-axis, but I am unable to Fix the two left columns in place as the code suggests.

 <script  type="text/javascript">
  var pTable ;
 $(document).ready( function () {
    pTable = $('#scheduleTable').dataTable( {
    "sDom": "<'row-fluid'r><'row-fluid't><'row-fluid'<'span6'i><'span6'p>>", 

    "sScrollY": 200,
    "sScrollX": "100%",
    "sScrollXInner": "100%",
    "bScrollCollapse": false,
    "fnInitComplete": function () {
       var fCols =  new FixedColumns( pTable , {
                "iLeftColumns":2,
                "sHeightMatch" : "auto",
                "iRightColumns": 0
                }
        );
      }
});

} );

</script>

I can see the FixColumns library via Firebug in Firefox but I cannot see how or if it is applied to the dataTable. It seems like the FixedColumns code is being ignored. Any thoughts on how to better debug this or to code this?

Thank you in advance.

Upvotes: 0

Views: 7598

Answers (1)

YuC
YuC

Reputation: 1847

@iowatiger08

have you tried this way:

var pTable ;
$(document).ready( function () {
    pTable = $('#scheduleTable').dataTable( {
        "sDom": "<'row-fluid'r><'row-fluid't><'row-fluid'<'span6'i><'span6'p>>", 

        "sScrollY": 200,
        "sScrollX": "100%",
        "sScrollXInner": "100%",
        "bScrollCollapse": false
    });
    new FixedColumns( pTable , {
        "iLeftColumns":2,
        "sHeightMatch" : "auto",
        "iRightColumns": 0
    });

});

Upvotes: 1

Related Questions