Best way to set table height from css

I use CustomLayout in my project to separate UI object and their style.

I have some problem with tables.

I define a div and I want the table’s height set to div’s height.

Which is the best way?

I thought:

table.setsizeFull() ;

in the code, but the result is not what I want.
I want the table full sized in div’s dimensions, both with or without elements inside.

Any suggest?


I think setSizeFull should work. Just make sure the customlayout’s location DIV has the proper height, since that’s used to determine the height of the table.

I need a %height.

Which class I have to modify?
The container DIV and the v-table-body class?

You need to set the table’s height in Java to 100%, plain CSS won’t work since the table’s client side widget needs to know that it has a percentage size (it doesn’t read it from the CSS).

For the location element, just use whatever class you choose, e.g.

<div location="mytable" class="foobar"></div>

.foobar {
   height: 100%;

Just make sure the parent element of ‘foobar’ has an explicit height set in CSS.

Is mytable.setSizeFull() instead mytable.setHeight(100%) correct?

SetSizeFull is just a shorthand for setWidth(100%) + setHeight(100%). So in this case both should work.

So, for manage the table style only with css I should set in the code:


Other properties to set?

With setPageLength(0) you are basically disabling the lazy loading of the table. It doesn’t affect the styling of the table.

And second, you can’t really manage the styling completely with CSS, the client side engine will always need to do some calculations for you (at least for now, don’t know after the complete rewrite which is planned for v.7.1). But that’s pretty much all you can do, then just override in CSS what you can without breaking things :slight_smile:

setPageLength(0) is only for lazy loading. Ok!

Ok, so I have to override css styles! Ok thank you very much!

I noted that the v-table height is calculated from nrows*rowheight, so the table height depends from the setPageLenght(), because the number of page lenght is the number of showed rows.

Is it right?

That’s true, but only if the table has an undefined height, i.e. you haven’t called setHeight for the table.

I don’t want call setHeight() because I want separate objects (java code) from appereance (css).
So the only method I call in the code must be setSizeXXX(), to expand o not the object.

Thanks for the replies.