Hello Team, I’m using V23
I’m using a grid and I want to show components in the column when the user hovers over a row, for example, Gmail(refer to image) but I don’t know what styles i should use to do something like that
I’m sharing my code please contribute to it
public void empGrid() {
List employeeList = new ArrayList<>();
employeeList.add(new Employee("Mike", "CA"));
employeeList.add(new Employee("Andrew", "NY"));
employeeList.add(new Employee("Sam", "LA"));
employeeList.add(new Employee("Antony", "SC"));
GridPro<Employee> mygrid = new GridPro<>();
mygrid.addColumn(Employee::getName).setHeader("Name").setFlexGrow(1);
mygrid.addColumn(Employee::getLocation).setHeader("Location").setFlexGrow(1);
mygrid.addComponentColumn(e -> {
HorizontalLayout layout = new HorizontalLayout();
Button remove = new Button("x");
remove.addThemeVariants(ButtonVariant.LUMO_ERROR,ButtonVariant.LUMO_SMALL);
remove.addClickListener((event) -> {
//something actions
});
layout.add(remove);
return layout;
}).setTextAlign(ColumnTextAlign.END).setFlexGrow(0).setWidth("1px");
mygrid.setItems(employeeList);
add(mygrid);
}
}
class Employee {
String name;
String location;
public Person() {
}
public Employee(String name, String location) {
this.name = name;
this.location = location;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
}