Is their a way where I can bind an Id with row in datatables?
I get 3 columns from my database and display 2 in datatable to user, but what I want is to attach 1st column (which is Id
) to whole row so that when user clicks on a particular row, it takes user to different page depending on Id.
ex
"aoColumns": [
{ "mData": "Id",
"bSearchable": false,
"bSortable": false,
//"bVisible": false,
"fnRender": function (oObj) {
return '<a href=\"Details/' + oObj.aData[0] + '\">Id</a>';
}
},
{ "mData": "FullName" },
{ "mData": "Age" }
]
and this is what I get in Json
{"sEcho":"1","iTotalRecords":1,"iTotalDisplayRecords":1,"aaData":[{"Id":425,"FullName":"xxx","Age":21,}]}
also oObj.aData[0]
always comes out as undefined? I am showing FullName
and Age
but want user to click on row level.
Any help will be appreciated
Thanks