Topic: Angular Datatable Filter

Kloew free asked 4 years ago


Expected behavior

Your angular datatable support searching.... but I need Filter too.

Actual behavior

Only Searching is supported. How can I apply a Filter. In the filtered Result I can search ....

Resources (screenshots, code snippets etc.)

Every Datatable should support this basis features, even free components have this :-(


Arkadiusz Idzikowski staff commented 4 years ago

I'm not sure what is the exact problem with this feature. Searching works like filtering, it displays only the rows that match search term.


Kloew free commented 4 years ago

thanks that you are looking for my problem:

I am searching in my rows, with the following code:

  searchItems() {
    const prev = this.mdbTable.getDataSource();

    if (!this.searchText) {
      this.mdbTable.setDataSource(this.previous);
      this.elements = this.mdbTable.getDataSource();
    }

    if (this.searchText) {
      //this.elements = this.mdbTable.searchLocalDataBy(this.searchText);
      this.elements = this.mdbTable.searchLocalDataByFields(this.searchText, this.searchProperties);

      this.mdbTable.setDataSource(prev);
    }

    this.mdbTablePagination.calculateFirstItemIndex();
    this.mdbTablePagination.calculateLastItemIndex();

    this.mdbTable.searchDataObservable(this.searchText).subscribe(() => {
      this.mdbTablePagination.calculateFirstItemIndex();
      this.mdbTablePagination.calculateLastItemIndex();
    });
  }

But before I am searching in my rows / elements, I want to apply an filter to the elements, where i can search in.... like with a seperate filter dropdown, or filter Buttons,... ( For example "only state XXX"), ....


Arkadiusz Idzikowski staff commented 4 years ago

Can you add an example use case with more details? I'm not sure if I understand the problem correctly.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 9.0.1
  • Device: pc
  • Browser: google chrome
  • OS: win10
  • Provided sample code: No
  • Provided link: No