vaadin-grid

Vaadin grid - filtering with lazy loading

佐手、 提交于 2019-12-08 05:43:51
问题 I have vaadin grid, and it's great that it has lazy data loading from the box. But for some reasons I have custom filters, which I use via CallbackDataProvider<> dataProvider.fetch(Query query) Query object has parameters for loading by portions ( offset and limit ), so I need to set it dynamically (?) and somehow listen grid scrolling event to load next part of data when user scrolls down (?) Grid.dataComunicator has field Range pushRows but there no public methods to get it. And all i have

Right-align column contents in Vaadin Grid?

独自空忆成欢 提交于 2019-12-07 12:33:46
问题 In the new Vaadin Grid widget (alternative to venerable Table), how does one right-align numbers or other content in a column? 回答1: The simplest way I can think of is to define your own CSS classes and style generator, pretty much similar to what I'd had done when working with tables. @Theme("mytheme") @Widgetset("com.matritza.MyAppWidgetset") public class MyUI extends UI { @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true) @VaadinServletConfiguration(ui = MyUI.class

Right-align column contents in Vaadin Grid?

时间秒杀一切 提交于 2019-12-06 02:36:21
In the new Vaadin Grid widget (alternative to venerable Table ), how does one right-align numbers or other content in a column? Morfic The simplest way I can think of is to define your own CSS classes and style generator, pretty much similar to what I'd had done when working with tables. @Theme("mytheme") @Widgetset("com.matritza.MyAppWidgetset") public class MyUI extends UI { @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true) @VaadinServletConfiguration(ui = MyUI.class, productionMode = false) public static class MyUIServlet extends VaadinServlet { // meh, default

Vaadin 10 grid style individual row based on contents

主宰稳场 提交于 2019-12-06 01:20:05
I am using a Vaadin grid to display incoming information and update it in realtime. I have been able to style all of the rows by accessing the DOM like so: <dom-module id="my-grid" theme-for="vaadin-grid"> <template> <style> [part="row"] { height: 27px; font-size: 14px; max-height: 27px; } </style> </template> </dom-module> What I am trying to do is set specific styling to certain rows based on the contents of the data of the row. Basically I have a column of booleans and if it's true, I want the row to have a green background, and if it's false I want that row to have a red background. Now

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

只愿长相守 提交于 2019-12-05 05:32:12
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("fullName"); nameColumn.setHeaderCaption("Full Name"); nameColumn.setEditorField(getNoEditableTextField());

How to display checkboxes instead of boolean in vaadin grid?

余生长醉 提交于 2019-12-04 08:48:02
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 ? You have to add generated columns for your checkboxes GeneratedPropertyContainer gpcontainer = new GeneratedPropertyContainer(container); gpcontainer.addGeneratedProperty("columnName", new PropertyValueGenerator<CheckBox>() { @Override public CheckBox getValue(Item item, Object itemId, Object propertyId) { // set

How to add a generated column to Vaadin 8 Grid?

跟風遠走 提交于 2019-12-04 05:47:10
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. 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.addColumn(Address::getPostalCode); grid.addCOlumn(Address::getCity); If you want to add a generated column

Vaadin Grid vs Table

回眸只為那壹抹淺笑 提交于 2019-11-30 07:51:45
问题 What is the difference between the Grid and Table components in Vaadin 7? Which should I use, and when? 回答1: Grid is a new more powerful component which is supposed to be the successor of Table (see The Table is dead, long live the Grid). So there should not be any need to favor Table over Grid. Here is a first in the series of articles by Vaadin aboout migrating from Table to Grid: https://vaadin.com/blog/-/blogs/mission-rip-table-migrate-to-grid-basic 回答2: Summary Grid → New & Amazing Table

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

霸气de小男生 提交于 2019-11-29 15:17:38
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. I considered two approaches: Two step process of replacing bean items. (1) First remove all BeanItem objects with Container::removeAllItems method. (2) Then add replacement BeanItem objects with the

Vaadin - Refresh grid after row modification

两盒软妹~` 提交于 2019-11-29 13:51:27
I create simple grid with data from database: BeanItemContainer<Customer> container = new BeanItemContainer<>(Customer.class, customerRepository.findAll()); Grid grid = new Grid(container); To edit each row the button was created: Button edit = new Button("Edit", clickEvent -> openWindow((Customer) grid.getSelectedRows().iterator().next())); This open new window with edit form. After all changes accepted, I must manually refresh whole page to see modification on Grid. My question is: How refresh only Grid after modification of any row entry? And how save those modifications to database (maybe