Ok, pracowałem nad małym projektem do użytku z DataTables. Jest to wtyczka jQuery grid i Ive ma większość funkcjonalności działającej zgodnie z zamierzeniami. Jedyne, co wydaje mi się nie do końca objąć, to odświeżenie siatki w edytorze AJAX Inline.jQuery DataTables, odśwież siatkę po aktualizacji (przetwarzanie po stronie serwera)
<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>
To jest mój plik updatedata.php
$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";
mam echo na końcu, ponieważ wydaje się pop alert() niektóre miejsca i echo wypełnia tę alert z informacją.
Znam funkcje do przerysowywania siatki jak fnDraw, ale jestem bez pojęcia, jak wdrożyć.
Spotkałem się tak samo jak ty :) i czekam na lewę. – sophie
uwaga na wstrzyknięcie. –