Ok, tôi đã làm việc trên một dự án nhỏ để sử dụng với DataTables. Một plugin lưới jQuery của nó và Ive có hầu hết các chức năng làm việc như dự định bây giờ. Điều duy nhất tôi không thể dường như quấn quanh đầu của tôi là làm cho lưới làm mới trên chỉnh sửa AJAX Inline.Dữ liệu jQuery, lưới làm mới sau khi cập nhật (xử lý phía máy chủ)
<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>
Đây là tập tin updatedata.php tôi
$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";
Tôi có tiếng vang ở cuối vì nó có vẻ bật một alert() một số nơi và tiếng vang lấp đầy mà cảnh báo với thông tin.
Tôi biết về các chức năng vẽ lại lưới như fnDraw nhưng không có dấu vết như cách triển khai.
Tôi đã gặp giống như bạn :) và đang chờ lừa. – sophie
hãy cẩn thận khi tiêm. –