Editable Table - Wrong focus FW 7+

Table is loosing focus on value change.
Replication:

  1. Open Cuba sampler, Components-> Table -> Editable Table
  2. hide columns other than Name and Age
  3. select age in any row, edit value, press Tab

I made a gif from sampler for better explanation.
In FW 6, this worked perfectly, since FW 7, every value change breaks focus.

edit-table-key-2

EDIT:
We found out that if same table settings are used inside in edit screen eg. Vehicle contains composition of Service notes, this table have correct focus, gif:
edit-table-inside-editscreen

UPDATE:
It is working correctly only if all columns of table are marked editable.
If at least 1 column is marked editable=“false”, full table refresh happens on every value change.

Hello @expresado

You can solve the problem with replacing non editable columns by generated columns with Labels. In this case focus will be switched correctly.

2 Likes

Thank you very much for workaround.
Here is code that should work fine

@Override
public void init(Map<String, Object> params) {
    super.init(params);
    groupTable.getColumns().forEach(col->{
        if(!col.isEditable()){
            col.setColumnGenerator(entity->{
                Label<String> label = uiComponents.create(Label.class);
                Object val = entity.getValueEx(col.getIdString());
                label.setValue(metadataTools.format(val));
                return label;
            });
        }
    });
}

EDIT: #format instead of #instancename and string casting, v2 #format does null check also!

By the way, you can use MetadataTools#format(value) instead of metadataTools.getInstanceName and String.valueOf. It will show correct decimal / date format depending on your locale.

1 Like

Hi @artamonov,

Good that there is a workaround, but will this be fixed in 7.1 ? For months I scan the forum to assess the stability of the platform v7, waiting for the good moment to upgrade.

Our project is very big, and I would like to avoid us spending weeks coding workarounds here and there just to have the same level of functionnality than platform v6.

Regards
Michael

Hello @michael.renaud

Most likely this case will never be fixed, because it’s related to Table rendering process and requires a lot of work to re-write it.

Regards,
Daniil

image Add to aggregation properties.
How do you resolve this wrong focus problem?