Replacing column text with images - column text representing values in database

I need to replace a text value in a table column with an image. Here is the use case:

  1. I have a screen that shows search criteria fields (of type a. lookups, b. texts, c. dates).
  2. On clicking the Search button on the screen, the results are displayed in a table at the bottom section of the same screen. The results data is extracted from the database as a “Collection”.
    I get the following error as soon as the JVM tries to executes the following in screen controller:
    i wish to replace the text values in the “status” column with three images.

registrationsTable.addGeneratedColumn(“status”, entity -> {
if (entity.getStatus() == null) {
return null;
}
String[] statuses = entity.getStatus().split(";");

	HBoxLayout hBoxLayout = componentsFactory.createComponent(HBoxLayout.class);
	hBoxLayout.add(getLinkButtonForDocumentStatus(statuses[0]));
	hBoxLayout.add(getLinkButtonForVerificationStatus(statuses[1]));
	hBoxLayout.add(getLinkButtonForKYCStatus(statuses[2]));
	
	return hBoxLayout;
	});

Hi, @jasvir.singh

There is an example of using images in tables in our documentation: link.

Also, take a look at the example in Sampler: link.

Regards,
Daniil.

I continue to get the same exception as I used to before I posted the question:

“java.lang.ClassCastException: com.haulmont.cuba.core.entity.KeyValueEntity cannot be cast to com.singx.cust.onboarding.entity.Registrations”

The init() method is of no use in my case as I ma using custom data source that extends “CustomValueCollectionDatasource”.

Could you share small test project where the problem can be reproduced?

The problem of CCE stands fixed.

Thanks for your support.