我有一个表格,当用户从下拉列表中选择一个选项时,数据将返回其中,但附加的数据没有获得 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 关注
- 82 浏览
添加回答
举报
0/150
提交
取消