Topic: bug on angular tables example

iomote pro asked 5 years ago


Hi think I found a bug on your documentation code example. In the angular data table example TS code, the changePage function uses a wrong if condition https://mdbootstrap.com/angular/angular-tables/advanced-table-tutorials-examples/  
changePage(event: any) {

    if (event.target.text >= 1 && event.target.text <= this.lastPageNumber /* this.maxVisibleItems */) {

      this.activePage = +event.target.text;

      this.firstVisibleIndex = this.activePage * this.maxVisibleItems - this.maxVisibleItems + 1;

      this.lastVisibleIndex = this.activePage * this.maxVisibleItems;

    }

  }
Is it correct? should I made some other changes to have less results on more pages?

Arkadiusz Idzikowski staff answered 5 years ago


Dear iomote, Thank you for the detailed explanation. We will take a closer look at this problem. Regards, Arek

iomote pro answered 5 years ago


if I only change the maxVisibleItems value (say for example 5), all the pagination links above chosen value (6, 7, 8...and so on) will not work, unless I modify the if loop as suggested in my code:
...&& event.target.text <= this.lastPageNumber...
instead of
...&& event.target.text <= this.maxVisibleItems

Damian Gemza staff answered 5 years ago


Dear iomote, Could you please specify, what's wrong in your opinion in this if statement? Also, if you want to have fewer results on more pages, please change maxVisibleItems variable value from 10 to for example 5. Best Regards, Damian

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: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 6.2.2
  • Device: any
  • Browser: any
  • OS: any
  • Provided sample code: No
  • Provided link: Yes