Server-side processing and editable rows
Server-side processing and editable rows
Hi Allan,
I have this script, that was working client side before, I'm transferring it server-side, I want to edit the 8th col, I used to put an id= in the 8th td that I wanted to edit, so I can identify which item I'm working on, now that it server-side, how can I know which record I'm working on ? can I put an id=xx in the json data?
thank you in advance
I have this script, that was working client side before, I'm transferring it server-side, I want to edit the 8th col, I used to put an id= in the 8th td that I wanted to edit, so I can identify which item I'm working on, now that it server-side, how can I know which record I'm working on ? can I put an id=xx in the json data?
thank you in advance
This discussion has been closed.
Replies
What I think you'll need to do is introduce a hidden column into your table. That hidden column will have the database ID of the row, and you'll be able to get that using the API functions. The hidden column of course will never be presented to the end user - use http://datatables.net/usage/columns#bVisible
Regards,
Allan
in my case I didn't need to create an invisible col, I had the data in an visible one, and I managed to get it to the server like that
[code]
$('#tableOne tbody tr td:nth-child(8)').editable( '/data/editNote/', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata":function (settings, self) {
var aPos = oTable.fnGetPosition( this );
var aData = oTable.fnSettings().aoData[ aPos[0] ]._aData;
return {idData: aData[2]}; //take idData from third column
}
//and get it server-side
$value = $_REQUEST['value'];
$idData = $_REQUEST['idData'];
...
[/code]