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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -