Is it possible to add new table attribute with serverside data in Jquery datatable -
currently against every table row is
<tr id="123" class="odd" data-title="abc">
i adding data-title attributes using
"fncreatedrow": function (nrow, adata, idataindex) {
$(nrow).attr('data-title', 'abc'); }
what want accomplish value instead of abc data-title attribute in table row, way of doing in datatables? data comes serverside {"secho":"1","itotalrecords":193,"itotaldisplayrecords":193,"aadata":[{"userid":0,"dt_rowid":123, "data_title": "test"}]}
thanks in advance help.
try this:-
assuming adata
{"userid":0,"dt_rowid":123, "data_title": "test"}
"fncreatedrow": function (nrow, adata, idataindex) { $(nrow).attr('data-title', adata['data_title']); }
if complete json {"secho":"1","itotalrecords":193,"itotaldisplayrecords":193,"aadata":[{"userid":0,"dt_rowid":123, "data_title": "test"}]}
, idataindex
index of record in array then:-
then :-
$(nrow).attr('data-title', adata['aadata'][idataindex]['data_title']); }
Comments
Post a Comment