javascript - Spliting a VERY long table in multiples pages html/php -
here problem. have no right create database , receive csv countain massive amount of info each day. (more 200 000 rows)
data must create accessible on intranet. created simple html/php page extract rows , display informations in table filter on every column simple fgetcsv.
problem web browser not suited display much informations @ same time makes crash or freeze while, , can't while.
i wanted know if knew way page "load first 100 rows exemple, automatically create next page load , display next 100 rows etc."
i manages display first x rows , when clicked button table expand next x rows, still loaded @ once. y remaining hidden, browser still dies or freeze.
any thought ?
thanks
it's generic pagination question really. doesn't matter if info stored in database or in csv file.
just pass offset argument php script via query string or url rewriting , utilize select part of csv list.
like this: /big-table.php?page=3
.
// getting passed argument. $pagenumber = (int) $_get['page']; // items per page default. $itemsperpage = 100; // calculating offset. $offset = ($pagenumber - 1) * $itemsperpage;
then utilize $offset
, $itemsperpage
retrieve part of csv file limiting scope of csv parsing loop.
you can pass items per page value argument script in order command value web interface. example, if want create dropdown menu ability select 10, 50, 100 items per page, etc.
and if want - utilize ajax fetch more items dynamically, doesn't impact pagination implementation server-side, output format (json instead of html).
of course of study database implementation work faster , recommend opt instead if possible. and/or can utilize caching layer speed things up.
javascript php jquery html ajax
No comments:
Post a Comment