Topic: Cannot read property 'searchLocalDataBy' of undefined
Hello, I have literally followed the example tutorial and it indicates that this function is not defined.
ERROR TypeError: Cannot read property 'setDataSource' of undefined
@ViewChild(MdbTableDirective, { static: true }) mdbTable: MdbTableDirective;
elements: any = [];
elementsCopy: any = [];
searchText = "";
previous: string;
constructor(public ticketsService: TicketsService) {}
@HostListener("input") oninput() {
if (!this.alreadyGetterTickets) {
this.searchItems();
}
}
ngOnInit() {
this.ticketsService.getTickets().subscribe((res) => {
const response = res;
this.elements = response["message"];
this.elementsCopy = response["message"];
this.previous = this.elementsCopy;
setTimeout(() => {
this.mdbTable.setDataSource(this.elements);
this.previous = this.mdbTable.getDataSource();
this.alreadyGetterTickets = false;
}, 500);
});
}
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Opened
Specification of the issue
- User: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: 9.3.1
- Device: Desktop PC
- Browser: Edge
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Tags
Arkadiusz Idzikowski staff commented 2 years ago
Please provide full HTML/TS code of the table so we can reproduce this problem on our end.