Nested Data Table is not function , while clicking Jquery

 Nested Data Table is not function ,  while clicking Jquery:


while clicking the detail-control class is not firing its function. the following code am using Nested DataTable is not functioning , in Jquery while click:

$('#tblDataTable tbody').on('click', 'tr td.details-control', function () {

                var tr = $(this).closest('tr');

                var row = dt.row(tr);

                var idx = $.inArray(tr.attr('id'), detailRows);

 

                if (row.child.isShown()) {

 

                    row.child.hide();

                    tr.removeClass('details');

 

                    // Remove from the 'open' array

                    detailRows.splice(idx, 1);

                }

                else {

 

                    row.child(format(row.data())).show();

                    tr.addClass('details');

 

                    // Add to the 'open' array

                    if (idx === -1) {

                        detailRows.push(tr.attr('id'));

                    }

                }

            });

 

            dt.on('draw', function () {

                $.each(detailRows, function (i, id) {

                    $('#' + id + 'td.details-control').trigger('click');

                });

            });


Comments

Post a Comment