Problem when row.child.show() is called

Problem when row.child.show() is called

madjackmadjack Posts: 8Questions: 4Answers: 0

When i show child row with details information just like in example https://datatables.net/extensions/responsive/examples/child-rows/whole-row-control i catching error:

**uncaught exception: Unable to automatically determine field from source. Please specify the field name. For more information, please refer to https://datatables.net/tn/11**

so, what im doing wrong?

Answers

  • kthorngrenkthorngren Posts: 21,365Questions: 26Answers: 4,956

    Duplicate of this thread. Please don't duplicate posts.

    Do you have inline editing enabled? Guessing that inline editing is trying to invoke. If using inline editing you may want to configure Responsive to use only the column with the Plus, like this example:
    https://datatables.net/extensions/responsive/examples/child-rows/column-control.html

    Kevin

  • madjackmadjack Posts: 8Questions: 4Answers: 0

    Yes. Im using inline editing. But im not using responsive. Im onclick event just showing row child. Like in example:

                // Add event listener for opening and closing details
                $('#table 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(getDetails(row.data())).show();
                        tr.addClass('shown');
                    }
                });
    
  • madjackmadjack Posts: 8Questions: 4Answers: 0
  • kthorngrenkthorngren Posts: 21,365Questions: 26Answers: 4,956

    Sounds like you need to adjust the selector your inline editor event is using. Something like this example:

    $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
    

    The td:not(:first-child) will keep the inline editor from activating when clicking the first column. Assuming that is where you have the child detail control.

    Kevin

This discussion has been closed.