我的數據表腳本看起來像這樣如何添加按鈕,在jQuery的數據表
var getsourcinglist = function (url){
$('#ajaxLoader').show();
$.ajax({
type : 'GET',
url : url,
beforeSend : function() {
console.log('sending request to fetch');
},
success : function(data) {
$('#ajaxLoader').hide();
printTheSourcinglistview(data);
},
error: function(data){
$('#ajaxLoader').hide();
console.log(data);
}
});
}
var printTheSourcinglistview = function(data){
var trHTML = "" ;
var table = $('#dataTable1').dataTable({
"bProcessing": true,
aaData: data,
buttons: [
'copy', 'excel', 'pdf'
],
"aoColumns": [
{ "mData": "rrno" },
{ "mData": "name" },
{ "mData": "dob" },
{ "mData": "gender" },
{ "mData": "job_profile" },
{ "mData": "graduation" },
{ "mData": "total_exp" },
{ "mData": "phone" },
{ "mData": "salary_drawn" },
{ "mData": "salary_expected" },
{ "mData": "email" },
{ "mData": "status" },
{ "mData": "<button id="x">Click!</button>" },
],
});
table.buttons('output:name', '.export').enable();
console.log(table);
}
和HTML表格是在這裏
<table id="dataTable1" class="table table-bordered table-striped-col">
<thead>
<tr>
<th>Sourcing ID</th>
<th>Name</th>
<th>Dob</th>
<th>Gender</th>
<th>Job Profile</th>
<th>Basic/Graduation</th>
<th>Total Exp</th>
<th>Contact</th>
<th>Salary Drawn</th>
<th>Salary Expected</th>
<th>Final Status</th>
<th>Email</th>
<th>Action</th>
</tr>
</thead>
</table>
我得到那個按鈕HTML無法識別的錯誤。
任何幫助
感謝
' 「<按鈕ID =」 X「>點擊!「'語法錯誤 – gcampbell