JSON data doubt
JSON data doubt
Hi Alan,
I have a requirement where i have to send in data to datatables from JSON object. So i did the following:
$('#example').dataTable( {
"data": dataSet,
"columns": [
{ "title": "Engine" , "data" : "fieldName1"},
{ "title": "Browser", "data" : "fieldName2"},
{ "title": "Platform", "data" : "fieldName3"},
{ "title": "Version", "data" : "fieldName4"},
{ "title": "Grade", "data" : "fieldName5"}
]
});
In addition, i also need to add a check box and in another column i need to add an edit link to all rows, so i tried the following:
{ "title": "<button>Delete Selected</button>" , "?????" : "??I need to add a check box here????"},
{ "title": "Edit" , "?????" : "??I need to add a edit link here????"},
{ "title": "Browser", "data" : "fieldName2"},
{ "title": "Platform", "data" : "fieldName3"},
{ "title": "Version", "data" : "fieldName4"},
{ "title": "Grade", "data" : "fieldName5"}
How do i add those checkboxes and edit links. Edit link will only work for each row individually. The delete Selected button should delete all the rows with checkboxes selected
This question has an accepted answers - jump to answer
Answers
Sounds like you want to use
columns.render
orcolumns.defaultContent
. There is an example usingcolumns.defaultContent
in the Editor examples: https://editor.datatables.net/examples/simple/inTableControls.html .Allan
Gee thanks, that helped.