KeyValueContainer and edit action


I’ve created a KeyValueContainer attached to some DataGrid. All data are read and displayed fine.

Now I want to edit some record. When I push edit button, application sends me “KeyValueEntity.edit” screen doesn’t exists. OK, I agree. Please tell me: how does I link record in datagrid with editor screen ?


PS: KeyValue management is not so well documented …

1 Like


to open the editor for your entity in the KeyValueContainer you should load additional property that can be used for relation your entity and editor, for instance, entity’s id or even the whole entity:

<data readOnly="true">
    <keyValueCollection id="customersDc">
        <loader id="customersDl">
                <![CDATA[select e,, from demo_Customer e]]>
            <property name="customer" class=""/>
            <property name="customerId" datatype="uuid"/>
            <property name="customerName" datatype="string"/>

Then just override Edit action in the controller and open editor:

Controller code
private GroupTable<KeyValueEntity> customersTable;
private ScreenBuilders screenBuilders;

public void onCustomersTableEdit(Action.ActionPerformedEvent event) {
    KeyValueEntity entity = customersTable.getSingleSelected();

    screenBuilders.editor(Customer.class, this)

In the case of id, you should send it as a screen parameter to the editor and then load an entity by its id.

I have created an issue to improve KeyValueContainer documentation: issue.

Thank you very much. :wink: