DataTables - Expand Child details without using Ajax

前端 未结 3 2104
情歌与酒
情歌与酒 2021-01-31 10:16

I\'m working on a page that uses jquery DataTables (version 1.10). The TableData source is currently being sent as just an HTML table on the rendered page, and works perfect. Ho

3条回答
  •  忘掉有多难
    2021-01-31 10:57

    You can store the data for the child row in a data attribute of the parent row and change the format method from the example accordingly. Something like

    In your HTML:

    
        ParentRow
        No. 1
    
    

    In the click handler (line 50 from the example):

    row.child(format(tr.data('child-name'), tr.data('child-value'))).show();
    

    And as format method something like:

    function format (name, value) {
        return '
    Name: ' + name + '
    Value: ' + value + '
    '; }

提交回复
热议问题