How to show columns.render in a child row

How to show columns.render in a child row

bitmacherbitmacher Posts: 15Questions: 6Answers: 0

Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

This question has an accepted answers - jump to answer

Answers

  • bitmacherbitmacher Posts: 15Questions: 6Answers: 0

    Sorry, I was to fast on the button......

    Hello community,

    after long time I have a question regarding the column.render function for the child rows.

    For the "normal" rows there is no problem, I can show them with this code:

    $(document).ready(function() {
        editor = new $.fn.dataTable.Editor( {
        ajax: "controllers/staff_veranstaltung.php",
        table: "#example",
        template: '#customForm',
        fields: [ 
               { data: "webproject", render: "[, <br> ].webname" }
       ],
    

    But to show the same fields in the child row I found no solution at the moment.

    function format(d) {
        
        // `d` is the original data object for the row
        return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
            '<tr>' +
            '<td>Webprojekt:</td>' +
            '<td>' + d.webproject + ', render: ' + [, ].webname + '</td>'
            '</tr>' +
            '</table>';
    }
    

    Is there also a possibility to show the content in the child rows?

    Thanks a lot for a small hint.

    Best regards
    Mac

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    That's right, that format, [,].webname, is specific to the columns.render function - you'll need to construct it yourself in your format() function.

    Colin

  • bitmacherbitmacher Posts: 15Questions: 6Answers: 0

    Hello Colin,

    thanks for the quick answer. If I'll find an appropriate solution, I'll post it here.

    Mac

Sign In or Register to comment.