Well, I was working on a small project for use with DataTables. Its jQuery grid plugin and Ive got most of the functionality that works as intended. The only thing I canβt bow my head to do is update the grid on AJAX Inline edit.
<script type="text/javascript" charset="utf-8"> $(document).ready( function () { var oTable = $('#example').dataTable({ "bJQueryUI": true, "bProcessing": true, "sAjaxSource": "/test/server_processing.php", "sPaginationType": "full_numbers", "aoColumns": [ { "bVisible": false }, null, null, null ] }).makeEditable({ sAddURL: "AddData.php", sAddHttpMethod: "GET", sDeleteHttpMethod: "GET", sDeleteURL: "DeleteData.php", sUpdateURL: "UpdateData.php", oAddNewRowButtonOptions: { label: "Add...", icons: {primary:'ui-icon-plus'} }, oDeleteRowButtonOptions: { label: "Remove", icons: {primary:'ui-icon-trash'} }, oAddNewRowFormOptions: { title: 'New Toll Free number', show: "blind", hide: "explode", modal: true }, sAddDeleteToolbarSelector: ".dataTables_length" }); } ); </script>
This is my updatedata.php file
$editedColumn = $_POST['columnId']; $editedValue = $_POST['value']; $id = $_POST['id']; if ($editedColumn == '1') { $sql = "update Main set name='$editedValue' where id='$id'"; } elseif ($editedColumn == '2') { $sql = "update Main set dn='$editedValue' where id='$id'"; } elseif ($editedColumn == '3') { $sql = "update Main set dn1='$editedValue' where id='$id'"; } /* Update a record using information about id, columnName (property of the object or column in the table) and value that should be set */ $sql2 = "select name from Main where id = '$id';"; mysql_query($sql) or die(mysql_error()); echo "Update ok, reload to see changes";
I have an echo at the end, because it seems that a warning () is appearing somewhere, and the echo fills this notification with information.
I know about functions for redrawing the grid, for example fnDraw, but I donβt know how to implement it.