具有 x-editable 的数据表不发送 ajax 数据

DataTables with x-editable not sending ajax data

我正在尝试使用 x-editable 插件使数据表可编辑。 一切正常,但发送编辑后的数据。当我单击单元格时,编辑器正在打开,但没有任何内容发送到后端。

这是我的代码。这是 fiddle.

// DataTables
let isDataTables = document.getElementById('dataTable');
if (isDataTables !== null) {
    $.extend( true, $.fn.dataTable.defaults, {
        dom: "<'row'<'col-sm-3'B><'col-sm-3'l><'col-sm-3'f><'col-sm-3'r>>" + "<'row'<'col-sm-12't>> " + "<'row pad10top'<'col-sm-6'i><'col-sm-6'p>>",
        //serverSide: true,
        select:true,
        stateSave: true,
        pagingType: "full_numbers",
        scrollY:    "60vh",
        scrollCollapse: true,
        pageLength: 50,
        responsive: {
            details: false
        }
    } );
}
$('#dataTable').DataTable( {    
    "drawCallback": function(){
        $.each ($("#dataTable td"), function (i, v) {
            tmp_pk = $(this) .closest($('tr')).attr('id');
            $(this).attr('data-pk', tmp_pk);
        });

        //let api = this.api();
        //$('.editable', api.table().body())
        $('td.controle').editable({
            url : '/response',
            pk: tmp_pk,
            ajaxOptions: {
                type: 'put'
            }
        })
    },
} );

我终于在常见问题解答中找到了问题的答案:

Data is not submitted to server! Why? The most possible reason is that you have empty pk or url options. If you want to submit data without pk please set send option to "always".

Also form is not submitted if you did not change value. To manage this behavior see savenochange option.

https://vitalets.github.io/x-editable/faq.html