Two grid layout questions

At the moment I am developing a kind of timetable with a grid layout. While working on that I came over two question, where I did not find any solution until now. I hope somenone can help me.

1.) I want the following layout: The first column should have a fix width of 120px. Startinf from the second the number of columns is dynamically, therefore I do not want to enter a fix width, instead the other columns should fill up the grid to 100% meaning the complete width of the window. I think this has to be done with the expand ratio function but I am not sure how to handle the function in this case.

2.) The second question is a little more tricky: Each row is displaying a certain time of the day, meaning at least I have 24 rows representing the 24 hours of the day. The whole grid is put into a scroll panel. Now I want the following thing: When the application is loaded the scroll panel should irectly jump to the right time, meaning if it is 12 o´clock the scroll panel should go to the 12. row of the application. In a normal html layout I would simply add an anchor to each hour and call it. But I did not find a lot about anchots in vaadin, ist that possible or not?

I want to say thank you in advanced for each one who reads this thread.

  1. You should set the expand ratio to 0 on the first column and e.g. 1 for the rest. Make sure that you have a sized component in the first column, such as a Label (setWidth(“120px”)).

  2. The only way to scroll a panel is to call setScrollTop() and try to guess the amount of pixels. I seem to recall a scrollTo(Component) method, but it’s not in the API so I might have misremembered.

Scrollable.setScrollTop(pixels) might be what you’re remembering. Without trying it right now, my guess is you’d want to do this in the panel’s (or whatever parent you’re writing) attached() method:

    public void attach() {
        myPanel.setScrollTop( .... );