I’m a bit stuck on the following code:
$(document).ready(function () {
/* Init DataTables */
var oTable = $('#example').dataTable();
/* Apply the jEditable handlers to the table */
$('td', oTable.fnGetNodes()).editable('../examples_support/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'),
"column": oTable.fnGetPosition(this)[2]
};
},
"height": "14px"
});
});
notice it references ‘../examples_support/editable_ajax.php’, the contents of that php file is:
<?php
echo $_POST['value'].' (server updated)';
?>
I’m stuck on two fronts:
1) how would I convert the code in editable_ajax.php to its equivalent in asp.net?
2) What file do I need to create in asp.net to reference like the php code up there is being referenced? I tried creating a regular cs file but I don’t think that was the right thing to do.
Since you posted this is MVC3… first your route (very specific to this particular call)
Then you need an EditableAjaxController.cs:
The EditableAjaxViewModel:
The
/Views/EditableAjax/Index.cshtmlview: