Hey,
I’ve been reading the documentation outlined here: ValuesPicker :: Jmix Documentation regarding valuespicker for entities with custom lookup and select screens.
This is my ValuesPicker XML definition in Screen 1 with id screen-1 for example:
<valuesPicker id="valuePicker" icon="COGS" responsive="true" caption="msg://valuePicker.caption">
<actions>
<action id="select" type="values_select">
<properties>
<property name="entityName" value="UserEntity"/>
<property name="selectValueScreenId" value="CustomUserSelect.browse"/>
</properties>
</action>
<action id="clear" type="value_clear"/>
</actions>
</valuesPicker>
When I click the selection icon the correct CustomUserSelect.browse screen opens. There the Java implementation looks like this:
@UiController("CustomUserSelect.browse")
@UiDescriptor("custom-user-select-browse.xml")
@LookupComponent("userEntitiesTable")
public class CustomUserSelect extends StandardLookup<UserEntity> implements SelectValueController<UserEntity> {
@Autowired
private GroupTable<UserEntity> userEntitiesTable;
@Override
public void setSelectValueContext(SelectValueContext context) {
}
@Override
public List<UserEntity> getValue() {
return this.userEntitiesTable.getSelected()
.stream()
.toList();
}
}
Here’s the XML definition for the custom user select:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window"
focusComponent="userEntitiesTable">
<data readOnly="true">
<collection id="userEntitiesDc"
class="com.company.UserEntity">
<fetchPlan extends="_base"/>
<loader id="userEntitiesDl">
<query>
<![CDATA[select e from UserEntity e order by e.username]]>
</query>
</loader>
</collection>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
</facets>
<actions>
<action id="lookupSelectAction"
caption="msg:///actions.Select"
icon="LOOKUP_OK"
primary="true"
shortcut="${COMMIT_SHORTCUT}"/>
<action id="lookupCancelAction"
caption="msg:///actions.Cancel"
icon="LOOKUP_CANCEL"/>
</actions>
<dialogMode height="50%"
width="80%" forceDialog="true" modal="true"/>
<layout expand="userEntitiesTable" spacing="true">
<groupTable id="userEntitiesTable"
width="100%"
dataContainer="userEntitiesDc" multiselect="true">
<columns>
<column id="username"/>
<column id="firstName"/>
<column id="lastName"/>
<column id="active"/>
</columns>
<simplePagination/>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="true">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>
The problem is that when I click the select button I’m expecting the CustomUserSelect screen to close, which does happen, but in screen-1 the valuepicker never seems to get its value set and is constantly null? Is it due to badly configured actions or a wrongly implemented SelectValueController??
Any help would be greatly appreciated.