Cannot read property 'searchLocalDataBy' of undefi


Topic: Cannot read property 'searchLocalDataBy' of undefined

AlexMart pro premium asked 7 months ago

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);
    });
  }

Arkadiusz Idzikowski staff commented 7 months ago

Please provide full HTML/TS code of the table so we can reproduce this problem on our end.


Please insert min. 20 characters.
Status

Open

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: Angular
  • MDB Version: 9.3.1
  • Device: Desktop PC
  • Browser: Edge
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No