Can someone tell me what the mallets below are?
- change the title of a screen according to some situation
- add png icon in a dataGrid according to the line record
Can someone tell me what the mallets below are?
Hello!
To change the title of the screen you can override method String getPageTitle()
. Although it wouldn’t be dynamically editable after the screen is shown due to the Vaadin behaviour.
To add png icon to datagrid you can use Image component with your pngs.
The location of static image resources in the project depends on the deployment method:
Web Archive (WAR) packaging
Under
/src/main/webapp
, such as/src/main/webapp/images/myimage.png
.JAR packaging (Spring Boot applications)
Under
/src/main/resources/META-INF/resources
, such as/src/main/resources/META-INF/resources/images/myimage.png
.
Here is some sample code to add images to datagrid column
entityDataGrid.addComponentColumn(entity -> {
Image image;
switch (entity.getNameField()) {
case "test1":
image = new Image("images/check.png","Check icon");
break;
case "test2":
image = new Image("images/check_circle.png","Circle check icon");
break;
default:
image = new Image("images/ban.png","Ban icon");
}
return image;
}).setHeader("Icon column");
Hello, after countless unsuccessful attempts, I’m asking for help.
in version 1.5, the table, there was an iconProvider handler, or in the columns another one called columnGenerator.
where through these two treatments were carried out, according to a condition, an image was set.
How to proceed with V2.0.2?
Hi!
In FlowUI you can use a special renderer
for it: https://demo.jmix.io/ui-samples/sample/data-grid-custom-renderer
Using the renderer
, you can create any component to display a record’s attribute.
Regards,
Dmitriy
With this tip I now managed to do it, it even uploaded the image.
However, how can I make the column included at the beginning of the grid and not at the end?
Is io.jmix.flowui.component.grid.DataGrid#setColumnPosition
method works for you?
top
everything ok, thanks