Hello,
I’m trying to add lookupField in the fieldGroup but I get nothing when I set the optionsList to the lookupField.
XML:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
caption="msg://editorCaption"
class="com.company.myProject.web.annotation.AnnotationEdit"
datasource="annotationsDs"
focusComponent="fieldGroup_1"
messagesPack="com.company.myProject.web.annotation">
<dsContext>
<collectionDatasource id="annotationsDs"
class="com.company.myProject.entity.Annotation"
loadDynamicAttributes="true"
view="_local">
<query>
<![CDATA[select e from myProject$Annotation e]]>
<filter>
<and>
<c>e.adSpace = :component$lookupField</c>
</and>
</filter>
</query>
</collectionDatasource>
</dsContext>
<dialogMode height="600"
width="800"/>
<layout expand="split"
spacing="true">
<split id="split"
orientation="vertical"
width="100%">
<fieldGroup id="fieldGroup_1"
datasource="annotationsDs">
<column width="250px">
<field custom="true"
property="adSpace"
required="true"
/>
<field property="type"/>
<field property="code"/>
<field property="isBestselling"/>
<field property="created"/>
<field property="enabled"/>
<field property="updated"/>
<field property="id"/>
</column>
</fieldGroup>
</split>
<frame id="windowActions"
screen="editWindowActions"/>
</layout>
</window>
AbstractEditor:
@Override
public void init(Map<String, Object> params) {
lookupField = componentsFactory.createComponent(LookupField.class);
Collection<Annotation> annotationCollection = annotationsDs.getItems();
if(CollectionUtils.isNotEmpty(annotationCollection)) {
adSpaceString = annotationCollection.stream()
.map(Annotation::getAdSpace)
.distinct()
.collect(Collectors.toList());
lookupField.setOptionsList(adSpaceString);
}
fieldGroup_1.getFieldNN("adSpace").setComponent(lookupField);
}
The same approach works in the browser screen but not in the editor screen.
Please let me know if I’m missing something.
Thanks