Javascript 使用链接中的行号的数据表
我有一个ajax服务器端表,我只想添加一个带有图标和链接的列 我有Javascript 使用链接中的行号的数据表,javascript,datatables,Javascript,Datatables,我有一个ajax服务器端表,我只想添加一个带有图标和链接的列 我有 {"targets": 4, "data": null, "defaultContent": "<a href='#'><i class='fa fa-pencil'></i></a>"} 我试过了 "defaultContent": "<a href='" + table.row(this).id() + "'><i class='fa
{"targets": 4,
"data": null,
"defaultContent": "<a href='#'><i class='fa fa-pencil'></i></a>"}
我试过了
"defaultContent": "<a href='" + table.row(this).id() + "'><i class='fa fa-pencil'></i></a>"}
我尝试了一切,但最终发现full[]是ajax返回的内容,其中一项不是数字索引,而是添加了“row”的DT_RowId,因此将前4个字符串起来变得相当简单,因此代码是
{"targets": 4,
"data": 'DT_RowId',
render: function(data, type, full, meta) {
return '<a href="edit.php?id='+ data.substring(4) +'"><i class="fa fa-pencil"></i></a>'
}
},
{“目标”:4,
“数据”:“DT_RowId”,
呈现:函数(数据、类型、完整、元){
返回“”
}
},
。而且效果很好。谢谢你的帮助。我尝试了所有方法,但最终发现full[]是ajax返回的内容,其中一项不是数字索引,而是添加了“row”的DT_RowId,因此将前4个字符串起来就成了一个相当简单的任务,因此代码是
{"targets": 4,
"data": 'DT_RowId',
render: function(data, type, full, meta) {
return '<a href="edit.php?id='+ data.substring(4) +'"><i class="fa fa-pencil"></i></a>'
}
},
{“目标”:4,
“数据”:“DT_RowId”,
呈现:函数(数据、类型、完整、元){
返回“”
}
},
。而且效果很好。谢谢您的帮助。您在吗,还是我应该删除答案?您在吗,还是我应该删除答案?
{"targets": 4,
"data": 'DT_RowId',
render: function(data, type, full, meta) {
return '<a href="edit.php?id='+ data.substring(4) +'"><i class="fa fa-pencil"></i></a>'
}
},