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);
It's not wrk, in the column "city" print this => [object Object]
How can i insert <small>
in column ?
I think you were nearly there except you're returning an object rather than a string that DataTables expects. Try something like this instead:
var editCitySmall = $("<small/>", {
"id": "editCity_" + clientId,
"onclick": "editCity('" + clientId + "')",
"class": "label pull-right bg-blue editTd"
}).prop("outerHTML");
That way you're returning the text of the small
object you've just created.
Let me know how you get on and if possible try to add a JSFiddle...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.