我正在尝试填充数据表:
let cb = this.API.all('cardboard_querys/' + $stateParams.id);
cb.customGET().then((response) => {
let data = response.data.cardboard_querys;
console.log('data',data)
this.dtOptions = DTOptionsBuilder.newOptions()
.withOption('data', data)
.withOption('responsive', true)
.withBootstrap()
.withDOM('<"html5buttons"B>lfTtipr')
this.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID').withOption('defaultContent', ''),
DTColumnBuilder.newColumn('request_type').withTitle('Tipo').withOption('defaultContent', ''),
DTColumnBuilder.newColumn('request_number').withTitle('request_number').withOption('defaultContent', ''),
]
});
我认为:
<table datatable="" class="table table-responsive table-striped"
dt-options="vm.dtOptions" dt-columns="vm.dtColumns">
</table>
但是我遇到以下错误:
TypeError: Cannot read property 'aDataSort' of undefined at _fnSortFlatten (final-b72999cec5.js:83355) at _fnSortingClasses (final-b72999cec5.js:83693) at loadedInit (final-b72999cec5.js:78692) at HTMLTableElement.<anonymous> (final-b72999cec5.js:78790) at Function.each (final-b72999cec5.js:362) at jQuery.fn.init.each (final-b72999cec5.js:157) at jQuery.fn.init.DataTable [as dataTable] (final-b72999cec5.js:78352) at jQuery.fn.init.$.fn.DataTable (final-b72999cec5.js:92552) at Object.renderDataTable (final-b72999cec5.js:108237) at Object.hideLoadingAndRenderDataTable (final-b72999cec5.js:108253) TypeError: Cannot read property 'parentNode' of null at _Api.<anonymous> (final-b72999cec5.js:86750) at _Api.iterator (final-b72999cec5.js:84495) at _Api.<anonymous> (final-b72999cec5.js:86749) at _Api.destroy (final-b72999cec5.js:84663) at jQuery.fn.init.DataTable.fnDestroy (final-b72999cec5.js:77895) at HTMLTableElement.<anonymous> (final-b72999cec5.js:78406) at Function.each (final-b72999cec5.js:362) at jQuery.fn.init.each (final-b72999cec5.js:157) at jQuery.fn.init.DataTable [as dataTable] (final-b72999cec5.js:78352) at jQuery.fn.init.$.fn.DataTable (final-b72999cec5.js:92552)
192/5000
我真的不知道我该怎么做,在另一个项目中它可以很好地工作。我也不是很熟练地说。我进行了很多搜索,但仍然找不到解决方法。
我在做什么错?预先感谢