alump / GridStack

Vaadin layout add-on using gridstack.js library
Apache License 2.0
10 stars 7 forks source link

Elements layout question #10

Closed Artgit closed 8 years ago

Artgit commented 8 years ago

In my application I want to use GridStack layout in order to implement visual sorting effect.

Right now I can't vertically align elements(panels) inside my GridStack .

With a following code:


        GridStackLayout decisionPanel = new GridStackLayout(1);
        decisionPanel.setSizeFull();
        decisionPanel.setAnimate(true);
        decisionPanel.setCellHeight(100);

        for (int i = 0; i < 10; i++) {          
            decisionPanel.addComponent(tooltips("" + i));
        }

        sp.setSecondComponent(decisionPanel);

I have a following visualization:

gridstack

but I need to show my panels inside GridStack as displayed at the following image(implemented with a VerticalLayout only for demo purpose):

verticallayout

What am I doing wrong and how to fix it ? Thanks

Artgit commented 8 years ago

Even with a following code it doesn't work as expected:

GridStackLayout decisionPanel = new GridStackLayout(1);
decisionPanel.setSizeFull();
decisionPanel.setAnimate(true);

for (int i = 0; i < 10; i++) {  
    Button tooltips = new Button("" + i);
    decisionPanel.addComponent(tooltips, 0, i);         
}

For testing purpose I'm going to show 10 buttons but as you can see from a screenshot below, I have only 5. Also, How to control vertical gaps between elements ?

buttons

alump commented 8 years ago

Try use the setCellHeight method with correct cell height. Grid stack needs to know the height of 1 slot. As it's grid after all. You can then define height component in slots when you add those to gridstack layout.

alump commented 8 years ago

I assume also this ticket can be closed.