我有一個表格,當用戶從下拉列表中選擇一個選項時,數據將返回其中,但附加的數據沒有獲得 x-editable 功能。我想知道如何將 x-editable 添加到表中的附加數據中。代碼view$(document).ready(function() { $('.username').editable({ url : this.url, pk : this.id, type : 'text', validate:function(value){ if($.trim(value) === '') { return 'This field is required'; } } }); $('select[name="school"]').on('change', function() { var schoolId = $(this).val(); console.log(schoolId); $('.data_table').DataTable({ "drawCallback": function(settings) { $('#ddd').html(settings._iRecordsTotal + ' Students'); }, processing: true, destroy: true, language: { processing: '<span>Processing...</span>', }, serverSide: true, ajax: '{{ url(' dashboard / studentsIndexData ') }}/' + schoolId, columns: [{ data: 'id' }, { data: 'photo' }, { data: 'students' }, { data: 'semester' }, { data: 'class' }, { data: 'action', orderable: false, searchable: false }, ], "order": [ [0, "desc"] ], dom: 'Bfrtip', buttons: [{ extend: 'copy', exportOptions: { columns: [0, ':visible'] } }, { extend: 'excel', exportOptions: { columns: ':visible' } }, { extend: 'csv', exportOptions: { columns: ':visible' } }, { extend: 'pdfHtml5', exportOptions: { columns: [2, 3, 1] } }, { extend: 'print', exportOptions: { columns: ':visible' } }, 'colvis' ] }); });});
1 回答

holdtom
TA貢獻1805條經驗 獲得超10個贊
解決了
我將我的editable功能移動到dataTables drawCallback現在它正在工作
"drawCallback": function( settings ) {
$('#ddd').html(settings._iRecordsTotal + ' Students');
$('.username').editable({
url : this.url,
pk : this.id,
type : 'text',
validate:function(value){
if($.trim(value) === '')
{
return 'This field is required';
}
}
});
},
它能做什么?
基本上它擁有可編輯的功能,直到 dataTables 將數據返回到表中。
希望對有需要的人有所幫助。
- 1 回答
- 0 關注
- 96 瀏覽
添加回答
舉報
0/150
提交
取消