How to sort a Column in a Table that containing image?

Hi,
I wish I could sort a column that contains an image ( see Label “severityLogo”) by a particular Object property (See property “priority”).
I see the image for every row, but if I click the Column Header, rows are not sorted.

Here my code:

Extract of my Allarm.java


@Entity
@Table(name = "allarm")
public class Allarm implements Serializable{

@Column(name = "priority")
private Integer priority;

/* ...other code.... */

@Transient 
 private Label severityLogo;

public Label getSeverityLogo() {
		String urllogo  = "<img src=\"" + VaadinServlet.getCurrent().getServletContext().getContextPath() +"/"+ NAME_IMAGE + "\" /> ";
		Label imgL = new Label(urllogo, ContentMode.HTML);
		return imgL;
	}
}

Extract of my View where I build my Table


allarms= JPAContainerFactory.make(Allarm.class,
    			DataProvider.PERSISTENCE_UNIT);

Table t = new Table() {
            @Override
            protected String formatPropertyValue(Object rowId, Object colId,
                    Property<?> property) {
                if (colId.equals("data") || colId.equals("lastcheck")) {
                    SimpleDateFormat df = new SimpleDateFormat();
                    df.applyPattern("dd-MM-yyyy");
                    return df
                            .format(((Date) property.getValue()).getTime());
                }
                
                return super.formatPropertyValue(rowId, colId, property);
            }
        };
        
        t.setSizeFull();
        t.addStyleName("borderless");
        t.setSelectable(true);
        t.addContainerProperty("severityLogo", Label.class, "priority"); //I want to order this column!!!!

        t.setColumnCollapsingAllowed(true);
        t.setColumnReorderingAllowed(true);
        segnalazioni.removeAllContainerFilters();
        t.setContainerDataSource(allarms);
        t.sort(new Object[] { "priority" }, new boolean[]
 { false});
        
        t.setVisibleColumns(new Object[] { "severityLogo", "name", "place", "data"});
        t.setColumnHeaders(new String[] { "Severity", "Name", "Place", "Data"});
        t.setMultiSelect(true);

You can add a HeaderClickListener to your table and do your sorting manually in there for the respective columns.

Or you can set a custom ItemSorter for the container if it supports one - several of the standard in-memory containers do.
Most database containers use container specific approaches to customize sorting.

You could also use a generated column which is backed e.g. by a transient Boolean field or other simple sortable field in your entities to avoid having Label instances there.