我将数据表用于表组件,并且在项目中实现了选项卡功能,但是在选项卡之间切换或来自其他页面数据表时无法正常工作。
这是我的表组件初始化:
self.table = $('#table-' + self.tableId).DataTable( {
responsive: true,
paging: self.showPagination,
searching: self.showSearch,
ordering: self.showOrdering,
// orderCellsTop: true,
info: false,
fixedHeader: true,
bDestroy: true,
// "scrollX": true,
order: [],
rowGroup: {
enable: self.showRowGroup,
dataSrc: self.rowGroupIndex
},
columnDefs : [ { orderable: false, targets: [ 3, 5, 6 ] }],
});
}, this.timeOut);
}
这是我的标签html:
<div *ngIf="showTaskList" class="container-fluid adjust-margin">
<tabset>
<tab heading="Open Tasks" id="openTab" (select)="getOpenProjectList($event)">
<app-table-section [tableColumns]="tableColumns"
[tableHeader]="tableHeaders"
[tabledata]="tableData" [isDataComplex]="false" [showPagination]="false"
[showAction]="true" [tableId]="'task-table'" [rowCount]="rowCount"
(editRecord)="editRecord($event,DMSModal);" [actionBtnSize]="true"
[showEdit]="showEdit" [showApproveBtn]="showApprove"
(deleteRecord)="deleteRecord($event);"
[showSearch]="false" (pagination)="getTaskList($event)" [addAttachment]="true"
[taskAttachmnetIds]="taskAttachmentId"
(editAttachmentRecord)="addTaskAttachments($event,DMSModal)"
(approvedTask)="approveRejectTask($event)" (copyData)="copyTaskData($event)" [showCopy]="true"
[showCustomPagination]="true" [showPreview]="false" [showTaskList]="false"
[totalItems]="totalItems" ></app-table-section>
</tab>
<app-table-section [tableColumns]="tableColumns"
[tableHeader]="tableHeaders"
[tabledata]="tableData" [isDataComplex]="false" [showPagination]="false"
[showAction]="true" [tableId]="'task-table'" [rowCount]="rowCount"
(editRecord)="editRecord($event,DMSModal);" [actionBtnSize]="true"
[showEdit]="showEdit" [showApproveBtn]="showApprove"
(deleteRecord)="deleteRecord($event);"
[showSearch]="false" (pagination)="getTaskList($event)" [addAttachment]="true"
[taskAttachmnetIds]="taskAttachmentId"
(editAttachmentRecord)="addTaskAttachments($event,DMSModal)"
(approvedTask)="approveRejectTask($event)" (copyData)="copyTaskData($event)" [showCopy]="true"
[showCustomPagination]="true" [showPreview]="false" [showTaskList]="false"
[totalItems]="totalItems" ></app-table-section>
</tab>
</tabset>
</div>
当我在这些过滤器之间切换时,我在同一页面上有过滤器,它给出了错误