Posts

Showing posts from August, 2017

Drag and Drop Rows on same Grid

Image
Working with Grids Now we shall move on to the Next Concept is about  Drag and Drop Grid Items on same Grid. A Grid component’s rows can be made draggable by applying GridDragSource extension to the component. The extended Grid’s rows become draggable, meaning that each row can be grabbed and moved by the mouse individually.  By default, the drag data of type "text" will contain the content of each column separated by a tabulator character ("\t"). When multiple rows are dragged, the generated data is combined into one String separated by new line characters ("\n"). You can override the default behaviour and provide a custom drag data for each item by setting a custom drag data generatorfor the "text" type. The generator is executed for each item and returns a String containing the data to be transferred for that item. In the First Post we have Created A Pojo named Company ,A ListDataprovider,A Grid of type Company and a List of type Co

Vaadin 8 Grid approach by ListDataProvider

For Vaadin 8 Grid we can use a List Data Provioder But first  why to use List Provider.? Instead of directly assigning the item collection as the items that a component should be using, we can instead create a  ListDataProvider  that contains the items. One list data provider instance can be shared between different components to make them show the same data. The instance can be further configured to filter out some of the items or to present them in a specific order. For components like  Grid  that can be separately configured to sort data in a specific way, the sorting configured in the data provider is only used as a fallback. The fallback is used if no sorting is defined through the component and to define the order between items that are considered to be the same according to the component’s sorting. All components will automatically update themselves when the sorting of the data provider is changed. We can write a code for ListDataProvider as follows :- First of a

Vaadin 8 Grid

Image
Moving On to the Latest Version of Vaadin In vaadin 8 Table is Removed So we may use Vaadin Grid instead if Vaadin Table. What is Vaadin Grid.? Grid  is for displaying and editing tabular data laid out in rows and columns. At the top, a  header  can be  shown, and a  footer  at the bottom. In addition to plain text, the header and footer can contain HTML and  components. Having components in the header allows implementing filtering easily. The grid data can be sorted by clicking on a column header; shift-clicking a column header enables secondary sorting criteria. Grid is fully themeable with CSS and style names can be set for all grid elements. For data rows and cells, the styles can be generated with a row or cell style generator. Now Coding Part In Grid. The Pre-requisites For Vaadin 8 Grid are:-  A pojo           SO First lets Build a Pojo class in java  package com.example.DemoProject; public class Company {     private int serialNo;