221
Views
8
Comments
Solved
Fixed Table Header issue
Question
Application Type
Reactive
Service Studio Version
11.54.1 (Build 62118)
Platform Version
11.18.1 (Build 38276)

HI,

I used the CSS below to fix table header, but I can't figure out how to avoid the visualization issue like the one highlighted in red in the attached image: when scrolling, the checkbox of each row is visible on top of the header and there is also a line of pixel of the underlying row that is still visible.

Someone knows if there is a way to avoid this tedious issue?


table {  
  text-align: left;  
  position: relative;
  border-collapse: collapse; 
}

th {  
  background: white;  
  position: sticky;
  top: 0; 
}


2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

you could remove the border on the table and add it to the wrapper container.

this is your css with some alterations, I think it looks decent :

- removed border on the table and added it to the wrapper

- the table selector should be on class, not element, because of specificity

- i thought is was nicer to make the whole header row sticky, instead of each individual header cell

- have 4 separate values for border radius, because it looks funny on the scroll bar otherwise



UserImage.jpg
Daniele Betti

Hi @Krishnanand Pathak 

I've already checked that guide but I would prefer to avoid creating 2 tables, one for header and the other for data.

In addition it makes use of fixed table layout, but i need an auto layout.

Thank you, Daniele

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi Daniele,

I agree, that solution proposed by Outsystems is not ideal, as it kills the flexibility of column widths adjusting to content.

The answer will be in looking at what exactly is going on with chrome dev tools and adjusting to avoid that, if I would have to guess, i'd say it will be in the area of maybe margins and z-index.

If you share an oml demonstrating the problem, I'll have a look.

Dorine

UserImage.jpg
Daniele Betti

Hi Dorine, thank you.

In the meantime I found some solutions to my issue, but it still remains a little one: when scrolling down the table records the top border disappear.

I looked around but it seems there is no solution currently... look at the attached oml.


Daniele

TestTableFixedHeader.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

you could remove the border on the table and add it to the wrapper container.

this is your css with some alterations, I think it looks decent :

- removed border on the table and added it to the wrapper

- the table selector should be on class, not element, because of specificity

- i thought is was nicer to make the whole header row sticky, instead of each individual header cell

- have 4 separate values for border radius, because it looks funny on the scroll bar otherwise



UserImage.jpg
Daniele Betti
2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Daniele Betti ,

Small follow up :

I would not bring that z-index to 999, but something like 200

reason : the backdrop of a popup has 250, so if you at some point would use popups together with this scrollable table, the header would poke through the backdrop.

Dorine

UserImage.jpg
Daniele Betti

Thx a lot, you're right.

I indeed needed to lower that to avoid issues with some popups.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.