Using Ajax, and adding Actions columns
Using Ajax, and adding Actions columns
First of all, congrats for your project, I like datatables ;)
I was reading the documentation and forum and I finally can use Datatables with ajax. The thing is I used this:
[code]
$('#myTable').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
'bPaginate': true,
"sPaginationType": "bootstrap",
'bLengthChange': true,
'bFilter': true,
'bSort': true,
'bInfo': true,
'bAutoWidth': false,
"sServerMethod": "POST",
"sAjaxSource": '/index.php/users/get_all',
"aoColumns" : [
{"mDataProp": "ID","sTitle": "Id"},
{"mDataProp": "NAME","sTitle": "Name"},
{"mDataProp": "ADDRESS","sTitle": "Address"} //and a couple of columns more
]
} );
[/code]
Everything is fine, awesome, but... I want to add an extra column with actions for every row (e.g. links for update and delete). I read fnRender is deprecated and now we should use mRender with mData.
I didn't manage to make my table work with mData, so I used mDataProp with aoColumns, and the examples I found where with aoColumnsDef and mData, so I don't know how to use mRender with my code o how "translate" my code to use aoColumnsDef with mData.
I hope I explained well.
I was reading the documentation and forum and I finally can use Datatables with ajax. The thing is I used this:
[code]
$('#myTable').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
'bPaginate': true,
"sPaginationType": "bootstrap",
'bLengthChange': true,
'bFilter': true,
'bSort': true,
'bInfo': true,
'bAutoWidth': false,
"sServerMethod": "POST",
"sAjaxSource": '/index.php/users/get_all',
"aoColumns" : [
{"mDataProp": "ID","sTitle": "Id"},
{"mDataProp": "NAME","sTitle": "Name"},
{"mDataProp": "ADDRESS","sTitle": "Address"} //and a couple of columns more
]
} );
[/code]
Everything is fine, awesome, but... I want to add an extra column with actions for every row (e.g. links for update and delete). I read fnRender is deprecated and now we should use mRender with mData.
I didn't manage to make my table work with mData, so I used mDataProp with aoColumns, and the examples I found where with aoColumnsDef and mData, so I don't know how to use mRender with my code o how "translate" my code to use aoColumnsDef with mData.
I hope I explained well.
This discussion has been closed.
Replies
Allan