javascript - How to have paginated table from database -
i've tried bunch of different react table solutions (reactable, griddle , work similar. can pass them set of data , populate table. offer pagination, not in since it's source. can pull 100 rows database, , show 10 @ time via table pagination. if data coming database / flux store, how supposed pull need database?
in case of relational database, handle pagination on database level, if rdbms supports it, in sql query itself. need following:
- make ajax query backend pagination settings: page size , page number
- in backend, issue query against database, using aforementioned settings, prepare json result.
- return results frontend, parse
json.parse()
, pass grid component.
in case of flux store, bit more complex has different notions relational database. basic principles same though, pass parameters access component, make query, return json or javascript objects.
pagination in rdmses
for example, in mysql (mariadb) pagination limit
qualifier:
select * table limit 20,10
the first parameter sets first record fetched, second limits maximum results. in example case, records between 20th , 29th fetched.
other databases work differently there no standard way of doing this. should documentation of rdms.
Comments
Post a Comment