[英]DataTables lose pageLength on new data
I have 2 tables by selecting row from table 1 data will return in table 2, for first time select everything is OK, but when I select second row table 2 will lose pageLength ability.我有 2 个表,通过从表 1 中选择行数据将返回表 2,第一次选择一切正常,但是当我选择第二行时,表 2 将失去 pageLength 能力。
myChapters: function(id) {
this.getChapters = '',
this.getVerses = '',
axios.get('/api/getChapters/'+id).then((res) => {
this.getChapters = res.data.chapters;
this.isLoadingChapters = false;
this.verse.book_id = id;
setTimeout(function() {
// dataTables
$("#chapters").DataTable({
select: true,
retrieve: true,
pageLength : 5,
lengthMenu: [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, 'All']]
});
}, 500);
})
.catch((err) => {
console.log(err)
});
},
Any idea?任何的想法?
I was talking something like this,我在说这样的话,
myChapters: function(id) {
this.getChapters = '',
this.getVerses = '',
axios.get('/api/getChapters/'+id).then((res) => {
this.getChapters = res.data.chapters;
this.isLoadingChapters = false;
this.verse.book_id = id;
if ($.fn.dataTable.isDataTable('#chapters')) {
$('#chapters').DataTable().clear().destroy(); //This will destroy datatable
}
setTimeout(function() {
// dataTables
$("#chapters").DataTable({
select: true,
retrieve: true,
pageLength : 5,
lengthMenu: [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, 'All']]
});
}, 500);
})
.catch((err) => {
console.log(err)
});
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.