繁体   English   中英

如何在数据字段上附加2个按钮

[英]How to append 2 buttons on a data-field

我在同一列中有两个要使用的按钮,我从ajax响应中创建这样的按钮:

.done(function (data) {
    qmissedTable.bootstrapTable('hideLoading');
    data.forEach(function (missedEntry) {
        qmissedTable.bootstrapTable('append', {
            product_id: missedEntry.id,
            product_weight: missedEntry.weight,
            product_added_date: missedEntry.added_date,
            product_modified_date: missedEntry.modified_date,
            button_1: "<button type=\"button\" class=\"getid btn btn-default image\" data-id=\"" + missedEntry.id + "\" >Select</button>",
            button_2: "<button type=\"button\" class=\"getid btn btn-default tara\"  onclick=\"onAddMissedEntryInfoClicked(" + missedEntry.id + ")\">Select</button>"
        });
    }
    );

现在,我想将button_1和button_2放在Insert Tara / Harvest列下的同一列中,这是我的观点:

 <table id="scale_missed_entries"
                   data-toggle="table"
                   data-pagination="true" 
                   >
                <thead>
                    <tr>
                        <th class="hidethis" data-field="product_id">ID</th>                           
                        <th data-field="product_weight">Weight</th>
                        <th data-field="product_added_date">Added date</th>
                        <th data-field="product_modified_date">Modified date</th>
                        <th data-field="button_1">Tara Image</th>
                        <th data-field="button_2 | button_1">Insert Tara/Harvest</th>
                    </tr>
                </thead>
 </table>

我尝试使用data-field =“ button_2 | button_1”,但我认为它不能接受2个参数,还有其他方法吗? 谢谢!

我认为这会有所帮助

$('th[data-field="button_2 | button_1"]').append("Your button")

您可以在编写时选择数据字段并使用附加功能

暂无
暂无

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

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