Uncaught TypeError: Cannot read property 'show' of undefined

Uncaught TypeError: Cannot read property 'show' of undefined

V24V24 Posts: 1Questions: 1Answers: 0
edited January 2020 in Free community support

hello please i need some help here my cose is showing
Uncaught TypeError: Cannot read property 'show' of undefined
at HTMLTableCellElement.<anonymous> (me.js:42)
at HTMLTableSectionElement.dispatch (jquery-3.4.1.js:5237)
at HTMLTableSectionElement.elemData.handle (jquery-3.4.1.js:5044)

here's my code for jquery

$(document).ready(function() {
                var table = $('#example').DataTable(options);
                 
                $('#example tbody').on('click', 'td.details-control', function () {
                    var tr = $(this).closest('tr');
                    var row = table.row( tr );
             
                    if ( row.child.isShown() ) {
                        // This row is already open - close it
                        row.child.hide();
                        tr.removeClass('shown');
                    }
                    else {
                        // Open this row
                        row.child(format()).show();
                        $('#inner').DataTable(options);
                        
                        tr.addClass('shown');
                    }
                } );
            } );

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    What does your format() function return?

    The Row Details example returns HTML generated from the row data:

            else {
                // Open this row
                row.child( format(row.data()) ).show();
                tr.addClass('shown');
            }
    

    If you are trying to make the Child table a Datatable you should look through this blog. Ypou can ignore the Editor portions of the blog if you aren't using the Editor.

    If you still have difficulties please please post a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.