Topic: MDB-Table-Pagination

Karthiga free asked 5 years ago


Expected behavior mdb-table-pagination should work if rows are less than 10 Actual behavior we are using for pagination , but the pagination does nt work if we have rows less than 10 . when noticed in description, it was mentioned like calculateLastItemIndex's default value is 10. How to make it work for rows less than 10 . Need a quick support. Thanks in advance Resources (screenshots, code snippets etc.)

ngAfterViewInit() { this.mdbTablePagination.setMaxVisibleItemsNumberTo(5); this.firstItemIndex = this.mdbTablePagination.firstItemIndex; this.lastItemIndex = this.mdbTablePagination.lastItemIndex;

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

}

onNextPageClick(data: any) { this.firstItemIndex = data.first; this.lastItemIndex = data.last; }

onPreviousPageClick(data: any) { this.firstItemIndex = data.first; this.lastItemIndex = data.last; }

constructor( private tableService: MdbTableService, private cdRef: ChangeDetectorRef ) {}


Damian Gemza staff answered 5 years ago


Dear Karthiga,

Please try to add the [searchDataSource]="your-data-array" input to the mdb-table-pagination component, and check if this resolves your problem.

If not, you have to wait until next Monday for the next version of the MDB Angular, where this problem is resolved.

Best Regards,

Damian


Karthiga free answered 5 years ago


Hi Damian

Thanks for the reply. We tired implementing below bit still pagination is not clickablengAfterViewInit() { this.mdbTablePagination.setMaxVisibleItemsNumberTo(3); this.mdbTablePagination.lastVisibleItemIndex = 3; this.mdbTablePagination.lastItemIndex = 3;

this.firstItemIndex = this.mdbTablePagination.firstItemIndex;
this.lastItemIndex = this.mdbTablePagination.lastItemIndex;

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

}


Damian Gemza staff answered 5 years ago


Dear Karthiga,

This problem will be resolved with the next release of MDB Angular.

Until now, as a workaround, please try set manually the value of lastVisibleItemIndex and lastItemIndex to your desired value from your component.ts file.

This could be done in the ngAfterViewInit hook:

this.mdbPagination.lastVisibleItemIndex = 5;
this.mdbPagination.lastItemIndex = 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: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.4.0
  • Device: Laptop
  • Browser: Chome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No