Jump to content

Recommended Posts

<?=new html_table_pager('select * from users :limit', 'postgres', 'header goes here')?>

The above is my html pager. The first arg is a query or an array of data followed by the database i want to use if i want to use one. My DB Api is configured for multiple dbs so thats why I need that and the header goes here is the table header and that is optional.

The table pager extends the html_table and html_table extends html_abstract. html_abstract pretty much turns html into a big object allowing me to use inheritance wherever I want.

The pager object is actually separate from the table object that autogens tables based on input. The pager object returns

$pager->link;
$pager->data;

My html_table_pager is just passing the data into the table_autogen and the link into $table->add_footer($pager->link);
The table autogen has a mode option and if this mode option is turned on (it is by default) it will show the name of the keys in a header that is below the main header. If the row count is equal to 1 it will appear on the left hand side instead of the top. I was thinking of adding a link there to sort my results easily but because the data is indirect I could only reverse sort or order what is currently inside the table. The problem with this is the data in the table is only what is needed for that one page. Because my pager slices the data up into the limits assigned by my pager script.

For example

the pager will show 5 results for example

1
2
3
4
5

but the total results might be 100, but if i try to reverse it it makes it

5
4
3
2
1

instead of

100
99
98
97
96
95

I think it will be a big pain to fix this an work around it to add the feature. I am wondering if anyone has done this before and how they did it. And also if anyone thinks I am making a big mistake by leaving the feature out. I will find it kind of annoying leaving it out as i am a perfectionist. But it will just be to much of a head ache to fix I think. Any Ideas?
Link to comment
https://forums.phpfreaks.com/topic/35094-table-auto-gen-and-paged-data/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.