I am trying to get Datatables to work with Mysql and PHP.
It is displaying the results but I want some results to be output as a html input box.
Is this possible?
Using fnRowCallback described here http://datatables.net/usage/callbacks you can do whatever you want with a row before it is inserted into the table. It works something like this:
[code]
$('#tableId').dataTable({
//...Other options...
fnRowCallback: function(tr, data, rowNum, index) {
$(tr).children().first()
.empty()
.append($(''));
}
});
[/code]
That code (untested) should empty the first td in each row and replace it with an input box with the same value in it (assuming you are using and array of arrays for your data and not an array of objects).
That's the idea at least. Of course, it's up to you how you are going to get what users put into those boxes and do something useful with it.
Replies
[code]
$('#tableId').dataTable({
//...Other options...
fnRowCallback: function(tr, data, rowNum, index) {
$(tr).children().first()
.empty()
.append($(''));
}
});
[/code]
That code (untested) should empty the first td in each row and replace it with an input box with the same value in it (assuming you are using and array of arrays for your data and not an array of objects).
That's the idea at least. Of course, it's up to you how you are going to get what users put into those boxes and do something useful with it.
[code]"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
$('td:eq(0)', nRow).empty().html( '