user1346664
user1346664

Reputation: 209

Table pagination without Javascript

Is there a way to implement a server-side pagination mechanism for a HTML table (no Javascript, AJAX, etc...)?

Upvotes: 0

Views: 1027

Answers (1)

RAM
RAM

Reputation: 2419

Yes, there is a mechanism. Since, you mentioned no server-side language, we can provide you the logic.

Lets say there are 941 rows in the table and the page size is 10. So, total pages would be 95 (941 / 10 = 94.1 and ceiling of 94.1 is 95).

For the default page (page number: 1), provide the first 10 rows and give the first number in the layout the pressed button look.

1 2 3 ... 95

When a user clicks on any number, behind the scene the server receives the corresponding page number, say i. Accordingly, the query is executed to fetch the (i-1)*10+1th, (i-1)*10+2th, ... , i*10th rows. Implement it manually or use the page function of the server-side language.

Upvotes: 1

Related Questions