Reputation: 12841
I am just starting out with the datatable jquery plugin. before I dig deeper I have a question if this is possible:
I have a user list, some users have two phone numbers assigned.
In the data table I want to display a select box if the user has more than one phone number.
Which methods should I check? I understand that you can use fnRender to customize a cell. But how can I access the json data in fnRender? () or is there another way? cheers.
Upvotes: 0
Views: 203
Reputation: 4918
I use mRender which is similar:
'aoColumns': [
{
'mData': 1,
'mRender': function (data, type, row) {
var newSelect = '<select><option>' + row[1][0] + '</option><option>' + row[1][1] + '</option>';
return newSelect;
},
...
This is simplified version, but row
is your returned json, in a 2d array to allow for multiple phone numbers. You'd have to build a selectlist control and return the html.
Upvotes: 1