如何 return a bootstrap table 作为 detailFormatter

how to return a bootstrap table as a detailFormatter

我在下面得到了这段代码,我正在尝试将 table returned 作为 bootstrap table 的 detailFormatter,如下所示。 ...

        $('#resultsTable').bootstrapTable({
        method: 'get',
        detailView: true,
        detailFormatter: tableDetailFormatter,
        data: data,
        striped: true,
        pagination: data.length > 5,
        pageSize: 5,
        pageList: [5, 10],
        onLoadError: function () { 
          // deal with error
        },
        columns: [
            { field: 'Name', title: '', class: 'col-md-6', sortable: true },
            { field: 'foo', class: 'col-md-3', title: 'foo', sortable: true },
            { field: 'bar', class: 'col-md-3', title: 'bar', sortable: true }
        ]
    });

    function tableDetailFormatter(value, row) {

        var detail = $.ajax({
            type: "GET",
            url: '/foo/foo?name=' + row.Name,
            async: false
        }).responseJSON;

       // how do you return this? there is no element for it ??
        $().bootstrapTable({
            method: 'get',
            data: detail,
            striped: false,
            pagination: sampleDetail.length > 5,
            pageSize: 5,
            pageList: [5, 10],
            onLoadError: function () { // deal with error },
            columns: [
                { field: 'Name', sortable: true }
                .... more columns....
            ]
        });
    };

如何获得 tableDetailFormatter 函数以 return html 进入主 table 的详细视图?

可以从 ajax 加载数据并绑定到 $detail。

$table.on('expand-row.bs.table', function (e, index, row, $detail) {
    $detail.html('Loading from ajax request...');
    $.get('LICENSE', function (res) {
        $detail.html(res.replace(/\n/g, '<br>'));
    });
});