Problem With Fixed Column

Problem With Fixed Column

Larry27Larry27 Posts: 35Questions: 10Answers: 0

When I try to invoke Fixed Column I get an error, specifically with the following line ",
fixedColumns: true"

If I remove that part of my string, it loads fine, although it doesn't seem to be setting the column width, lol

  <script type="text/javascript">
    jQuery( document ).ready( function( $ ) {

        var $tablesched26a = jQuery("#table-sched26a");
        $tablesched26a.DataTable({
            aLengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
            scrollY:        "300px",
            scrollX:        true,
            scrollCollapse: true,
            paging:         false,
            columnDefs: [
                { width: 20, targets: 0 }
            ],
            fixedColumns: true

        })

    });
  </script>

You caan find my page at the following URL;

http://www.mytownbudget.com/app/ON/Sched26a/sched_26a_UT.php?yr=2018&mun=25

here's the error I am getting;

datatables.js:94589 Uncaught TypeError: Cannot read property 'cell' of undefined
at FixedColumns._fnCopyLayout (datatables.js:94589)
at FixedColumns._fnClone (datatables.js:94819)
at FixedColumns._fnCloneLeft (datatables.js:94558)
at FixedColumns._fnDraw (datatables.js:94493)
at HTMLTableElement.<anonymous> (datatables.js:94127)
at HTMLTableElement.dispatch (jquery-1.11.3.min.js:4)
at HTMLTableElement.r.handle (jquery-1.11.3.min.js:4)
at Object.trigger (jquery-1.11.3.min.js:4)
at HTMLTableElement.<anonymous> (jquery-1.11.3.min.js:4)
at Function.each (jquery-1.11.3.min.js:2)

Any help you can offer would be greatly appreciated.

Larry

Answers

  • allanallan Posts: 63,219Questions: 1Answers: 10,416 Site admin

    Hi Larry,

    I think it is the empty tr in the footer that is causing the issue:

                <tfoot>
                    <tr>
                        <!--<th>Line</th>
                        <th>Func</th>
                        <th>Salaries</th>
                        <th>Debt Int</th>
                        <th>Materials</th>
                        <th>Contracts</th>
                        <th>Rents</th>
                        <th>Trsf Ext</th>
                        <th>Amort</th>
                        <th>Total Exp</th>
                        <th>Inter Func</th>
                        <th>Alloc Pgm Support</th>
                        <th>Total Expenses</th>-->
                    </tr>
                </tfoot>
    

    Could you remove the tfoot completely please?

    Thanks,
    Allan

  • Larry27Larry27 Posts: 35Questions: 10Answers: 0

    Hi Allan,

    Thanks for that tip, I removed the entire tfoot, but now get a different error

    dataTables.fixedColumns.min.js:19 Uncaught FixedColumns already initialised on this table

    Oddly, even with the ' fixedColumns: true' it seems that the fixed column width is in fact working. Which leads me to wonder about the purpose of the fixedColums setting though? Any ideas?

    Again, thanks for your response :)

    Larry

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • aquaFlamesaquaFlames Posts: 1Questions: 0Answers: 0

    Hi, I'm facing similar issue with "fixedcolumns already initialised on this table" which is much similar to "https://datatables.net/forums/discussion/40035/uncaught-exception-fixedcolumns-already-initialised-on-this-table#latest".
    Could you revert with suggested solution? Discussion was closed without specifying the resolution.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    There wasn't a solution, as we've not had an example to investigate. If you're seeing it, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.