首页 > 解决方案 > 我想在 Netsuite 仪表板中生成数据表

问题描述

使用引导程序,我制作了一个在 localhost 中运行良好的数据表。但是,当我将该代码片段添加到 NetSuite 仪表板表中的 portlet 时,显示但没有显示分页和搜索框。[Netsuite 仪表板中的数据表] [1]'''

define(['N/file'],
function (file) {
    function render(params) {
        params.portlet.title = 'Services';
        var myvar = '<!DOCTYPE html>' +
            '<html lang="en">' +
            '' +
            '<head>' +
            '    <title>Bootstrap Example</title>' +
            '    <meta charset="utf-8">' +
            '    <meta name="viewport" content="width=device-width, initial-scale=1">' +
            '    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">' +
            '    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.24/css/dataTables.bootstrap4.min.css">' +
            '</head>' +
            '<style type="text/css">' +
            '  div.dataTables_wrapper {' +
            '        margin-bottom: 3em;' +
            '    }' +
            '</style>' +
            '<body>' +
            '    <div class="container-fluid">' +
            '        <table id="" class="table table-striped table-bordered display" style="width:100%">' +
            '            <thead>' +
            '                <tr>' +
            '                    <th>Name</th>' +
            '                    <th>Position</th>' +
            '                    <th>Office</th>' +
            '                    <th>Age</th>' +
            '                    <th>Start date</th>' +
            '                    <th>Salary</th>' +
            '                </tr>' +
            '            </thead>' +
            '            <tbody>' +
            '                <tr>' +
            '                    <td>Tiger Nixon</td>' +
            '                    <td>System Architect</td>' +
            '                    <td>Edinburgh</td>' +
            '                    <td>61</td>' +
            '                    <td>2011/04/25</td>' +
            '                    <td>$320,800</td>' +
            '                </tr>' +
            '                <tr>' +
            '                    <td>Garrett Winters</td>' +
            '                    <td>Accountant</td>' +
            '                    <td>Tokyo</td>' +
            '                    <td>63</td>' +
            '                    <td>2011/07/25</td>' +
            '                    <td>$170,750</td>' +
            '                </tr>' +
            '                <tr>' +
            '                    <td>Michael Bruce</td>' +
            '                    <td>Javascript Developer</td>' +
            '                    <td>Singapore</td>' +
            '                    <td>29</td>' +
            '                    <td>2011/06/27</td>' +
            '                    <td>$183,000</td>' +
            '                </tr>' +
            '                <tr>' +
            '                    <td>Donna Snider</td>' +
            '                    <td>Customer Support</td>' +
            '                    <td>New York</td>' +
            '                    <td>27</td>' +
            '                    <td>2011/01/25</td>' +
            '                    <td>$112,000</td>' +
            '                </tr>' +
            '            </tbody>' +
            '        </table>' +
            '    </div>' +
            '    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>' +
            '    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>' +
            '    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>' +
            '    <script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>' +
            '    <script src="https://cdn.datatables.net/1.10.24/js/dataTables.bootstrap4.min.js"></script>' +
            '    <script type="text/javascript">' +
            '    $(document).ready(function() {' +
            '        $(\'table.display\').DataTable();' +
            '    });' +
            '    </script>' +
            '</body>' +
            '' +
            '</html>';


        var content = '<td><span><b>Hello!!!</b></span></td>';
        params.portlet.html = myvar;
    }
    return {
        render: render
    };
});

''' [在本地数据表中][2] [1]: https://i.stack.imgur.com/rfG1x.png [2]: https://i.stack.imgur.com/4A2pt.png

标签: javascriptdatatablenetsuiteportletsuitescript2.0

解决方案


推荐阅读