2

I have a table that contains 3 columns that need always stay at the left side and column that contains grid where each grid element represents one hour in day, so I need that column to be scrollable. I tried many suggested solutions, but most of them are using position absolute, which is a bad joke, since when I use it I lose advantage of table, e.g. height of row changes, those absolute positioned don't follow. And the other problem is that table consists of few Angular 2 components, it's not just plain html, which makes it harder. Is there any better solution than using position absolute?

1
  • Can we see some code examples of what you've tried? Commented May 17, 2017 at 7:33

3 Answers 3

1

Well, in the end I just went with this solution: Fix and Scrollable table structure using html div

It still uses absolute columns and so fixed widths and margins, but well I can live that as long as it works. About Angular component elements representing row of table, I just gave display: table-row to it and simply put td tags inside, so no longer need to use tr.

Sign up to request clarification or add additional context in comments.

Comments

1

I made this approach. I't will work for vertical and horizontal directions.

https://plnkr.co/edit/MWFJuiWsUoo39xbCwAKI?p=preview

onScrollA($evt) {
   this.divC.nativeElement.scrollLeft = evt.srcElement.scrollLeft;
}

Comments

0

Maybe try with position: sticky; But without code, it is hard to see where the problem is.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.