Jeditable, how to get the row ID when server side
Jeditable, how to get the row ID when server side
Hi there
Im also just a learner sorry to bug you on a probably very simple problem...
I have searched the forum, but still am having a problem with Posting the ID for the row , the Value is posting fine but i then need the value edited updated to the db in the right place. having done a print_r($_POST); to see what is being sent to the server it is always displaying the row_id as a null value here is a result of the print_r($_POST); Array ( [value] => 12 [id] => [row_id] => null )
example if iam editing a table where on say the 8th row (I have a Field called purchase_ID which is the primary) i am assuming on print_r($_POST); the [id] => [row_id] => 8 ? is that what i should expect?
Essentially Im not sure how to extract the row_id information from a serverside database
[code]
var oTable;
$(document).ready(function() {
oTable = $('#purchases').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "purchases_table2.php",
"fnDrawCallback": function () {
$('#purchases tbody td').editable( 'editable_ajax.php', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
return { "row_id": this.parentNode.getAttribute('id') };
},
"height": "14px"
} );
}
} );
} );
[/code]
thanks in advance for any help in advance
Best Regards,
Chet
Im also just a learner sorry to bug you on a probably very simple problem...
I have searched the forum, but still am having a problem with Posting the ID for the row , the Value is posting fine but i then need the value edited updated to the db in the right place. having done a print_r($_POST); to see what is being sent to the server it is always displaying the row_id as a null value here is a result of the print_r($_POST); Array ( [value] => 12 [id] => [row_id] => null )
example if iam editing a table where on say the 8th row (I have a Field called purchase_ID which is the primary) i am assuming on print_r($_POST); the [id] => [row_id] => 8 ? is that what i should expect?
Essentially Im not sure how to extract the row_id information from a serverside database
[code]
var oTable;
$(document).ready(function() {
oTable = $('#purchases').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "purchases_table2.php",
"fnDrawCallback": function () {
$('#purchases tbody td').editable( 'editable_ajax.php', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
return { "row_id": this.parentNode.getAttribute('id') };
},
"height": "14px"
} );
}
} );
} );
[/code]
thanks in advance for any help in advance
Best Regards,
Chet
This discussion has been closed.
Replies
I have the same problem, have you already solved it?
Thanks!
[code]
Array
(
[value] => The new value of the field I just edited!
[id] =>
[row_id] => 132
[column] => 0
)
[/code]
In this array, "id" is the id of the field that was just edited -- if you want this value to be set, you will have to set in the HTML. "row_id" is the id of the tag that the element is in. I would suggest setting the id of the to be the primary key of the value in your database. Don't worry about setting the id of the . When you get the array posted back to the server you can lookup the row id, and determine which field was edited by looking at the column number.
Good luck.