vaadin-grid

Programmatically select a row in Grid in Vaadin 7?

早过忘川 提交于 2019-12-23 01:14:07
问题 In the Grid widget in Vaadin 7.5.3, we can determine the current selection of rows by calling SelectionEvent::getSelected or Grid::getSelectedRows. So how do we set the selection programmatically? 回答1: While that's true that official documentation for Grid class doesn't have this method stated, still you can do it programmatically. I won't argue whether it's a bug or not. Firstly you need to know what is your SelectionMode . Then you can select a row (or rows): @Override protected void init

How to display checkboxes instead of boolean in vaadin grid?

佐手、 提交于 2019-12-21 15:18:09
问题 I'm trying to display my boolean values as a checkbox in a vaadin grid. I can't use the multi selection mode because i need two columns with checkboxes. The columns of the Checkboxes shell have a Caption but the Checkboxes itself shell be without a caption. Does anyone have an idea ? 回答1: You have to add generated columns for your checkboxes GeneratedPropertyContainer gpcontainer = new GeneratedPropertyContainer(container); gpcontainer.addGeneratedProperty("columnName", new

Update Grid with a fresh set of data, in Vaadin 7.4 app

依然范特西╮ 提交于 2019-12-18 08:39:34
问题 In the new Vaadin 7.4 release, the new Grid widget debuted as an alternative to the venerable Table. After getting a Grid displayed, I later want to replace the entire set of data with fresh data. Rather than update the individual rows, I want to simply replace them. I happen to be using a BeanItemContainer for easy read-only display of some objects with JavaBeans-style getter methods. 回答1: I considered two approaches: Two step process of replacing bean items. (1) First remove all BeanItem

Java/Vaadin - FormLayout custom hidden component implementation

我们两清 提交于 2019-12-13 17:14:22
问题 I am working on a web application in vaadin and am currently trying to implement an address book. I viewed the official implementations off github and tried to build off that. The issue I am experiencing is with the contact form. I want to be able to click a row in the grid and open up a form containing the information. (Similar to how it is done on their example) The component doesn't react as intended however. If I added the component directly to the main layout and try to toggle visibility

How to reverse vaadin Grid?

ぃ、小莉子 提交于 2019-12-13 07:57:16
问题 I'm trying to build a simple java application using Spring Boot and Vaadin. I need to add a table on UI like this: https://www.screencast.com/t/1c4xkr4IE It could be extended by periods. Looks like Vaadin Grid element perfectly fits my requirements, but it adds my rows as columns. Is it possible to reverse grid or maybe there is another way to build needed table? UPDATE Here are my code: @SpringComponent @UIScope public class MyDataEditor extends VerticalLayout { private final

Vaadin grid setBodyRowHeight doesn't exist in latest 8.1.4 API

允我心安 提交于 2019-12-13 07:25:34
问题 I'm trying to adjust the height of the rows since I'm using components and the Vaadin Grid documentation says you can do this by calling setBodyRowHeight however that method no longer seems to be available... UPDATE: I found the method setRowHeight() (the manual needs updating) however this also changes the column header row height which I don't want, I just want the rows to be taller (so the component fits) and not the header. 回答1: It appears that this is an issue in the latest version and

Vaadin flow: grid conditional background color

戏子无情 提交于 2019-12-13 02:51:10
问题 I want to color grid lines, depending on a condition. I try this: Java: gridEtudiant.setClassNameGenerator(t -> { if (t.getEtud_numero().startsWith("2")) { return "error_row"; } return ""; }); Css: td.error_row { background-color: red; } HTML <td id="vaadin-grid-cell-1" tabindex="0" role="gridcell" part="cell body-cell" first-column="" reorder-status="undefined" aria-selected="false" class="error_row" style="width: 100px; flex-grow: 1; order: 10000000;"><slot name="vaadin-grid-cell-content-1"

How to make only some columns editable in a Vaadin Grid?

China☆狼群 提交于 2019-12-10 04:13:23
问题 Vaadin Grid allows to be defined as editable with grid.setEditorEnabled(true); This makes all visible columns editable. However I don't want the user to edit an specific column, but seems like the editable is an all or nothing. The next best solution I have found is to define an editor field with a disabled editor, which almost does the trick but the user is still able to select the text and move the cursor (but the field is not editable anymore). Grid.Column nameColumn = grid.getColumn(

How to add a generated column to Vaadin 8 Grid?

落爺英雄遲暮 提交于 2019-12-09 18:16:37
问题 Looks like GeneratedPropertyContainer does not exist in Vaadin 8. How can we add a generated column to Vaadin 8 Grid? I appreciate if you can provide an example. 回答1: If you pass the bean class to the constructure of Grid then it will add all properties as columns to the grid. If you want to only have some properties as columns then don't pass the class to the constructor and add your columns manually like this: grid.addColumn(Address::getStreet); grid.addColumn(Address::getHouseNumber); grid

How to hook data-grid events in parent lit-element component?

旧街凉风 提交于 2019-12-08 10:24:57
问题 I want to react on events started by elements placed in the data-grid rows. Vaading data-grid prevents events from bubbling up to the parent component containing the grid. Having buttons placed in the grid column rendered for each row I cannot catch the click or any other event from the component that hosts the grid. The examples from https://vaadin.com/components/vaadin-grid/html-examples are relying on js hooks being attached in the html file. I am working with Lit-element and trying to do