2017-04-05 39 views
0

我有2個按鈕,我想,我從一個Ajax響應創建我的按鈕,這樣在同一列的使用方法:如何追加對數據場2個按鈕

.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我想擁有它們插入塔拉/嘉實列下同一列,這是我的看法:

<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> 

我try'ed與數據字段=「button_2 | button_1」但我認爲這不可能拿兩個參數,有沒有其他的方法?謝謝!

回答

0

我認爲這將有助於

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

您可以選擇數據字段,你在寫和使用附加功能

+0

我沒有拿到.append(「您的按鈕」)jQuery中的一部分,對於使用什麼,我應該在哪裏附加? –