Skip to content

Commit

Permalink
feat(demo): add demo for HeightByRowsHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
javier-godoy committed Dec 28, 2023
1 parent 171f8ea commit 368c450
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ public GridHelpersDemoView() {
addDemo(LazyMultiSelectionDemo.class);
addDemo(CheckboxColumnDemo.class);
addDemo(EmptyGridLabelDemo.class);
addDemo(HeightByRowsDemo.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*-
* #%L
* Grid Helpers Add-on
* %%
* Copyright (C) 2022 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/

package com.flowingcode.vaadin.addons.gridhelpers;

import com.flowingcode.vaadin.addons.demo.DemoSource;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;

@PageTitle("Height By Rows")
@DemoSource
@Route(value = "grid-helpers/height-by-rows", layout = GridHelpersDemoView.class)
public class HeightByRowsDemo extends Div {

public HeightByRowsDemo() {
setSizeFull();

Grid<Person> grid = new Grid<>();
grid.setItems(TestData.initializeData());

grid.addColumn(Person::getFirstName).setHeader("First name");
grid.addColumn(Person::getLastName).setHeader("Last name");
grid.addColumn(Person::getCountry).setHeader("Country");

GridHelper.setHeightMode(grid, HeightMode.ROW);
GridHelper.setHeightByRows(grid, 7);

add(grid);
}
}

0 comments on commit 368c450

Please sign in to comment.