0

I am using JSP and Html table tags in my pages and I have scriplets to execute java codes inside my jsp pages. I dynamically populates the Table data in UI from the DB, based on conditions, and there are almost 15 columns. [in future, more columns to be added]

I want the Table to be fixed as per browser's context size and there should be a Horizontal scroller beneath the table to scroll the additional columns.

I followed these links: Add horizontal scrollbar to html table

Table scroll with HTML and CSS

And i used <div> to wrap the Table and used below piece of CSS code:

div .clsTableDiv
{
    width: 500px;
    height: 110px;
    overflow-x: scroll;
    overflow-x: auto;
    overflow-y: hidden;
}

Also I tried to put overflow style directly to the Table, like:

<table class="clsTable" cellspacing="1" cellpadding="3" border="0" style="overflow-x: scroll; display: block; width: 500px; height: 110px;">
</table>

But somehow the scroller isn't working at all. I am not sure if I'm mistaking something or it's the scriplet that I used in JSp to populate data dynamically in the table, is preventing it. Please suggest me on this.

Jerry
  • 281
  • 4
  • 21
  • try to add the same style but to the container div that is wrapping the table, not to table itselft – Kareem Dabbeet Jun 28 '19 at 04:45
  • can you post your `scriplet` as well because i have tested your code with dummy data it worked well . – Swati Jun 28 '19 at 06:30
  • @Kareem Dabbeet, yes I added it to the container div only. It didnot work. Then I added it to table itself. It didn't work either. – Jerry Jun 28 '19 at 10:36
  • @Swati, the scriplet portion is little heavy, it basically invoking the DAO classes and executing the hibernate sql statements and getting back resutset. – Jerry Jun 28 '19 at 10:39
  • @Kareem Dabbeet, I verified that the horizontal scroll bar is appearing in Google chrome but somehow it's not appearing in IE11 browser. But we suppose to use ie, not chrome. How can I get that scroller in ie?? – Jerry Jul 02 '19 at 09:18
  • @Swati can u help me out with the above comment?? – Jerry Jul 02 '19 at 09:18
  • Post your related `code` and screenshot of output . – Swati Jul 02 '19 at 10:39

0 Answers0