Topic: use table with angular pro

Sergio Lopes free asked 4 years ago


Hi, How to use table with pagination and sorting with Mdb Angular Pro.  

Dawid Adach pro answered 4 years ago


Dear Sergio, This is a bit too generic question. Implementation depends on your case and how will you retrieve data from backend. I.e. if you API limits number of rows to 100 , your paginationton implementation will have to call API to gather values 101-200, 201-300 etc. If you would like to use pagination within thus 100, you can implement 2 variables ie.:
  1. limit - defined how many rows should be displayed (5,10,15,25,50,100...)
  2. page/offset - defining which page is beeing displayed
Using limit & page you can determine starting point I.e. if you set limit to 25 and you are on 3rd page you can calculate starting point of the table as below:
(page-1)*limit+1
i.e.
Page=3 Limit=25

(3-1) * 25 +1 = 2 * 25 + 1 = 51 

now you can use ngFor to display 25 rows starting from row number 51


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

  • User: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags