Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 4 weeks ago
table height 100%
I am new bee getting started with vaadin . I created a table I called setFullSize(), I was hoping this would use the entire height of the browser but its not,
here i smy code
import java.util.List;
import smdi.com.samples.vaadin.model.Person;
import smdi.com.samples.vaadin.service.DefaultPersonService;
import smdi.com.samples.vaadin.service.PersonService;
import com.vaadin.Application;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;
public class SimpleAddressBook extends Application {
private static String[] fields = { "Name","Work Phone", "Cell Phone", "Home Phone" };
private Table contactList = new Table();
private IndexedContainer addressBookData = createDummyData();
private Window window;
private static PersonService personService= new DefaultPersonService();
@Override
public void init() {
window= new Window();
contactList.setSelectable(true);
contactList.setSizeFull();
contactList.setHeight("100%");
contactList.setColumnCollapsingAllowed(true);
contactList.setContainerDataSource(addressBookData);
window.addComponent(contactList);
setMainWindow(window);
}
private static IndexedContainer createDummyData() {
List<Person> persons=personService.getPersons();
IndexedContainer ic = new IndexedContainer();
for (String p : fields) {
ic.addContainerProperty(p, String.class, "");
}
// Create dummy data by randomly combining first and last names
for(Person person :persons ){
Object id = ic.addItem();
ic.getContainerProperty(id, "Name").setValue(person.getFirstName());
ic.getContainerProperty(id, "Work Phone").setValue(person.getWorkPhone());
ic.getContainerProperty(id, "Cell Phone").setValue(person.getCellPhone());
ic.getContainerProperty(id, "Home Phone").setValue(person.getHomePhone());
}
return ic;
}
}
please help me make this 100% height.
Last updated on
you must insert the table inside a Layout then call setSizeFull() on the layout and the table, then call setExpandRatio(table, 1f); and set the layout as the window content.
public class TestApplication extends Application {
@Override
public void init() {
Window mainWindow = new Window("Layouttest Application");
{
VerticalLayout layout = new VerticalLayout();
{
Table table = new Table();
table.setSizeFull();
layout.addComponent(table);
layout.setExpandRatio(table, 1f);
}
layout.setSizeFull();
mainWindow.setContent(layout);
}
setMainWindow(mainWindow);
}
}
Last updated on May, 29th 2012
+1
You cannot reply to this thread.