Thanks to developer who created initial version of scrollable table using JavaScript and shared with everyone on http://www.webtoolkit.info/. It was not working in Chrome, Safari and Opera, so just modified the script to work in all browsers.
Also added dynamic height to it.
How to use this script?
var t = new ScrollableTable(document.getElementById('myScrollTable'), 40);
</script>
Also added dynamic height to it.
How to use this script?
- As mentioned in webtoolkit.info you just need to enter table id.
var t = new ScrollableTable(document.getElementById('myScrollTable'), 40);
</script>
- Here you need to mention height in percentage. something like 40 for 40% of screen height
- Table should have thead which will be present at the top of the table.
- Table should have tbody which will be scrollable.
- Table can have tfoot its optional.
Name | Surename | Age | City | Country | Pin |
---|---|---|---|---|---|
Shahib | Ulla | 25 | Bangalore | India | 78 |
John | Smith | 31 | John | Smith | 31 |
John | Smith | 32 | John | Smith | 31 |
John | Smith | 33 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 36 | John | Smith | 31 |
John | Smith | 37 | John | Smith | 31 |
John | Smith | 30 | John | Smith | 30 |
John | Smith | 31 | John | Smith | 31 |
John | Smith | 32 | John | Smith | 31 |
John | Smith | 33 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 34 | John | Smith | 31 |
John | Smith | 35 | John | Smith | 31 |
John | Smith | 36 | John | Smith | 31 |
John | Smith | 37 | John | Smith | 31 |
Name | Surename | Age | Name | Surename | Age |