Video of the machine we made for Techfest 2006.
Friday, September 10, 2010
Tuesday, June 23, 2009
Generic guide for Pagination in Web Pages
Pagination Steps.
The only variable needed to be defined: pageSize, say 2
1. Select total no of rows (noOfRows, say 5) from the database table into a variable.
2. Calculate ceil of noOfRows/pageSize, 5/2 = 2.5, ceil(2.5) 3.
3. So we will have 3 pages.
4. Now create links on the page showing 3 links ( 1,2,3 ).
5. User clicking any of them should send the value to the server.
6. Say user selects 2 (pageNum), now we need to fetch 2 and 3rd record.
7. Dividing the data into rows with pageSize 2, ({1,2},{3,4},{5}).
8. We need to calculate first and last record to be fetched from the database.
9. Calculate the value as
last = (pageSize * pageNum), 4
first = last-pageSize+1, 4-2+1, 3
10. Fire the query now(oracle):
select * from user where rownum between first and last.
Done :)
The only variable needed to be defined: pageSize, say 2
1. Select total no of rows (noOfRows, say 5) from the database table into a variable.
2. Calculate ceil of noOfRows/pageSize, 5/2 = 2.5, ceil(2.5) 3.
3. So we will have 3 pages.
4. Now create links on the page showing 3 links ( 1,2,3 ).
5. User clicking any of them should send the value to the server.
6. Say user selects 2 (pageNum), now we need to fetch 2 and 3rd record.
7. Dividing the data into rows with pageSize 2, ({1,2},{3,4},{5}).
8. We need to calculate first and last record to be fetched from the database.
9. Calculate the value as
last = (pageSize * pageNum), 4
first = last-pageSize+1, 4-2+1, 3
10. Fire the query now(oracle):
select * from user where rownum between first and last.
Done :)
Subscribe to:
Posts (Atom)
