tableObject = $("#example1").DataTable({
columns: [{ title: "Client Id" }, { title: "City" }]
});
var clientId = value['client_id'];
var editCitySmall = $("<small>", {
id: "editCity_" + clientId,
"onclick": "editCity('" + clientId + "')",
"class": "label pull-right bg-blue editTd"
});
tableObject.row.add([clientId, editCitySmall]).draw(false);
它不是wrk,在列&#34; city&#34; print this =&gt; [object Object]
如何在列中插入<small>
?
答案 0 :(得分:0)
我认为你几乎就在那里,除了你要返回一个对象而不是DataTables期望的字符串。尝试这样的事情:
var editCitySmall = $("<small/>", {
"id": "editCity_" + clientId,
"onclick": "editCity('" + clientId + "')",
"class": "label pull-right bg-blue editTd"
}).prop("outerHTML");
这样你就会返回刚刚创建的small
对象的文本。
让我知道你如何继续,如果可能的话尝试添加一个JSFiddle ......