jquery - datatable with html content -
i using jquery
datatable
, data input injson
format.
$('#newitembaskettab').datatable({ "aadata": result.itembasketdata, "aocolumns": [ {"mdataprop": "nic5dcodename"}, {"mdataprop": "asiccprodcodename"}, {"mdataprop": "unit_name"}, {"mdataprop": "prod_quantity"}, {"mdataprop": "prod_value"} ] });
now want place checkbox in first column of datatable
, based on id field in json
data, checkbox
needs checked
or unchecked
. possible add html content datatable
?
use mrender
property -
$('#newitembaskettab').datatable({ "aadata": result.itembasketdata, "aocolumndefs": [ { "atargets": [ 0 ], "mdata": "id", "mrender": function ( data, type, full ) { var checked = "checked"; if(data) { checked = "checked"; } return "<input type='checkbox' checked='" + checked + "'>"; } }, {"mdata": "nic5dcodename"}, {"mdata": "asiccprodcodename"}, {"mdata": "unit_name"}, {"mdata": "prod_quantity"}, {"mdata": "prod_value"} ] });
Comments
Post a Comment