简体   繁体   中英

Adding Column to jQuery Datatables

I want to add a column to a jQuery Datatable. It will be used to contain a delete button for each row, like I have for another table. The button picture and class are specific in the php file that retrieves the table data from a database.

Simply adding a column to the html as the following breaks the javascript on the page:

<th>New Column</th>

I do not see anything in the aoColumnDefs settings that does anything to the added column. What code and where do I need to add or edit to accommodate the new column?

I am not the original developer behind the existing tables.

您可能也忘记了为身体添加栏,如果您有“脚踩”的情况,则还需要为其添加另一栏。

You can add one or more th from here like Revenue2

<table class="mws-table">
        <thead>
        <tr>
            <th>Date</th>
            <th>Transaction ID</th>   
            <th>Segment</th>
            <th>Revenue</th>
        </tr>
        </thead>
        <tbody id="transactions">
        <tr>
            <td class="trDate"></td>
            <td class="transactionId"></td>
            <td class="segment"></td>
            <td class="revenue"></td>
        </tr>
        </tbody>
        <tfoot>
        <tr class="customFooterRow">
            <th>Total</th>
            <th></th>
            <th></th>
            <th align ="left" class="revenueTotal"></th>
        </tr>
        </tfoot>
    </table>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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