简体   繁体   English

如何在数据表上添加动态列

[英]How can I add dynamic columns on datatables

I am using jquery datatables to display data. 我正在使用jquery datatables数据表来显示数据。

 <table  class="report-tbl table-bordered" cellspacing="0" width="100%" id="report-tbl">
            <thead>
                <tr>
                    <th></th>
                    <th><span contenteditable="">Side A</span></th>
                    <th><span contenteditable="">Sode B</span></th>
                    <th><span contenteditable="">Side C</span></th>

                </tr>
            </thead>
            <tbody id="rowcontainer">

            </tbody>
        </table>

I want to happen is that when I click a button data-table will add a column 'Side D' . 我想发生的是,当我单击按钮数据表时,将添加一列“ Side D”

Do you have any idea on how I can do this. 您对我该怎么做有任何想法吗? Cause base on what I see in google. 原因基于我在Google中看到的内容。 jQuery data-tables do not support yet Add/Remove Dynamic columns. jQuery data-tables尚不支持“添加/删除动态”列。

Thank You, 谢谢,

如果您正在使用任何jquery库,请尝试此

$($("thead").find("tr")[0]).append("<th <span contenteditable="">Side D</span></th>");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM