我有一个表格,当用户从下拉列表中选择一个选项时,数据将返回其中,但附加的数据没有获得 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'
]
});
});
});
holdtom