Responsive DataTable with ul list

Responsive DataTable with ul list

lisamanuelalisamanuela Posts: 4Questions: 2Answers: 1

Hi :)
I had a dataTable with detail-control that showed an ul list. I had to improve this table to a responsive datatable. I just put one column always hidden, so that the "+" is always visible.
But now I have a problem to show the html ul list and above the hidden (responsive) columns.
Do you have an idea to solve my problem?

Thanks!

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    I'm afraid I don't actually understand - you want to show the hidden details above the row?

    Allan

  • lisamanuelalisamanuela Posts: 4Questions: 2Answers: 1

    Before I had something like this on the "Details-control click" Event

    $('#DeviceList tbody').on('click', 'td', 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(row.data())).show();
                                    tr.addClass('shown');
                                    d = row.data();
    
                                    $('#overview_' + d.ID).html('<ul class="list"></ul>');
                                    data = $('#overview_' + d.ID + ' ul');
                                    $.each(d.Clients, function (id, option) {
                                        try { data.append("<li>" + option + "</li>"); } catch (ex) { }
                                    });
    
                                    // set overview as default tab
                                    $("a[href='#overview_" + d.ID + "']").tab('show');
                                }
                            });
    

    But now I would like to put this Information in the responsive Event. So that if I open the responsive Thing on the "+" that this Information and the hidden columns would Show up.

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    If you want to modify the data that Responsive shows in its child rows, you need to provide your own custom renderer, which you can do with the responsive.details.renderer option.

    Allan

This discussion has been closed.