Row level functionality

Row level functionality

JugramJugram Posts: 10Questions: 0Answers: 0
edited May 2013 in General
Hello,

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 1th 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

[code]
"aoColumns": [
{ "mData": "Id",
"bSearchable": false,
"bSortable": false,
//"bVisible": false,
"fnRender": function (oObj) {
return 'Id';
}
},

{ "mData": "FullName" },
{ "mData": "Age" }
]
[/code]
and this is what i get in Json
[code]{"sEcho":"1","iTotalRecords":1,"iTotalDisplayRecords":1,"aaData":[{"Id":425,"FullName":"xxx","Age":21,}]}[/code]

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

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    > Is their a way where i can bind an Id with row in datatables?

    The 'magic' data source parameter name of `DT_RowId` will be used for the row id if it is found. `DT_RowClass` is the other one. The other option is to use fnCreatedRow and assign the id manually.

    Allan
  • JugramJugram Posts: 10Questions: 0Answers: 0
    Thanks Allan, that worked like a charm
This discussion has been closed.