Hi:
I have a very basic lookupField with an optionsContainer, but for some reason I can’t get it to show the instance name in the dropdown when it is loaded. Here’s the Entity Inspector. The indicated field has the data I want to show:
Here’s my Editor screen (v7) for the same Entity:
Here’s how the field is defined in my Customer entity:
Controller is the default generated code:
package com.paslists.custfm.web.customers;
import com.haulmont.cuba.gui.screen.*;
import com.paslists.custfm.entity.Customers;
@UiController("custfm_Customers.edit")
@UiDescriptor("customers-edit.xml")
@EditedEntityContainer("customersDc")
@LoadDataBeforeShow
public class CustomersEdit extends StandardEditor<Customers> {
}
XML is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="grpBoxCustomer"
messagesPack="com.paslists.custfm.web.customers">
<data>
<instance id="customersDc" class="com.paslists.custfm.entity.Customers" view="customers-view">
<loader/>
</instance>
<collection id="radeMasterDc" class="com.paslists.custfm.entity.Customers" view="rademasters_view">
<loader id="radeMasterDl">
<query><![CDATA[select e from custfm_Customers e
where e.respschema is not null
order by e.company]]></query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="editActions" spacing="true">
<tabSheet id="tabsMain" stylename="framed">
<tab id="tabGeneral" caption="General">
<hbox spacing="true">
<groupBox id="grpBoxCredit" caption="Credit Status">
<textField id="creditstatusField" dataContainer="customersDc" property="creditstatus"/>
</groupBox>
<groupBox id="grpBoxGeneral" caption="General">
<flowBox spacing="true">
<label value="Acct Rep"/>
<textField id="acctrepField" dataContainer="customersDc" property="acctrep" width="150px"/>
<label value="Custom Tag"/>
<textField id="customtagField" dataContainer="customersDc" property="customtag" width="100px"/>
</flowBox>
</groupBox>
</hbox>
<hbox id="hboxMain" spacing="true">
<groupBox id="grpBoxCustomer" caption="Address" spacing="true" width="AUTO">
<grid spacing="true">
<columns count="2"/>
<rows>
<row>
<label value="Company"/>
<textField id="companyField" dataContainer="customersDc" property="company" />
</row>
<row>
<label value="Division"/>
<textField id="divisionField" property="division"/>
</row>
<row>
<label value="Sec Addr"/>
<textField id="address2Field" dataContainer="customersDc" property="address2"/>
</row>
<row>
<label value="Prim Addr"/>
<textField id="address1Field" dataContainer="customersDc" property="address1"/>
</row>
<row>
<label value="City"/>
<hbox spacing="true">
<textField id="cityField" dataContainer="customersDc" property="city"/>
<textField id="stateField" dataContainer="customersDc" property="state" width="40px" maxLength="2"/>
<textField id="zipField" dataContainer="customersDc" property="zip" width="70px" maxLength="5"/>
<textField id="zip4Field" dataContainer="customersDc" property="zip4" width="50px" maxLength="4"/>
</hbox>
</row>
<row>
<label value="Country"/>
<textField id="countryField" property="country"/>
</row>
<row>
<label value="Contact"/>
<textField id="contactField" property="contact"/>
</row>
</rows>
</grid>
</groupBox>
<groupBox id="grpBoxContact" spacing="true" caption="Contacts">
<grid spacing="true">
<columns count="2"/>
<rows>
<row>
<label value="Phone"/>
<textField id="phoneField" property="phone"/>
</row>
<row>
<label value="Fax"/>
<textField id="faxField" property="fax"/>
</row>
<row>
<label value="EMail"/>
<textField id="emailField" property="email"/>
</row>
<row>
<label value="M/P Status E-Mail"/>
<textField id="mpemailField" property="mpemail"/>
</row>
<row>
<label value="Reports E-Mail"/>
<textField id="rptemailField" property="rptemail"/>
</row>
<row>
<label value="Upd Req E-Mail"/>
<textField id="updreqemailField" property="updreqemail"/>
</row>
<row>
<label value="ePAF E-Mail"/>
<textField id="pafemailField" property="pafemail"/>
</row>
</rows>
</grid>
</groupBox>
<groupBox id="grpBoxRADE" caption="RADE" spacing="true">
<grid spacing="true">
<columns count="2"/>
<rows>
<row>
<label value="Response Schema"/>
<textField id="respschemaField" dataContainer="customersDc" property="respschema"/>
</row>
<row>
<label value="Response Password"/>
<textField id="resppwdField" dataContainer="customersDc" property="resppwd"/>
</row>
<row>
<label value="RADE Master"/>
<lookupField dataContainer="customersDc" property="rademaster" optionsContainer="radeMasterDc" />
</row>
<row>
<label value="RADE Suppress"/>
</row>
</rows>
</grid>
</groupBox>
</hbox>
</tab>
</tabSheet>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>
The lookupField only displays customers where the respschema field is not null (radeMasterDc/radeMasterDl). The record in question (Trimark) fits the criteria (it contains “TMK”).
Here are the views:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<views xmlns="http://schemas.haulmont.com/cuba/view.xsd">
<view entity="custfm_Customers" name="customers-view" extends="_local">
<property name="rademaster" view="rademasters_view"/>
<property name="salesrepFk" view="_minimal"/>
<property name="mergedeliv" view="_minimal">
<property name="countflag"/>
<property name="delivcc"/>
<property name="delivemail"/>
<property name="delivervia"/>
<property name="delivpwd"/>
<property name="delivuser"/>
<property name="directory"/>
<property name="filepatterns"/>
<property name="finderlen"/>
<property name="finderpos"/>
<property name="keylen"/>
<property name="keypos"/>
<property name="layout"/>
<property name="port"/>
<property name="reclen"/>
<property name="sshkeyfile"/>
<property name="template"/>
<property name="typeflag"/>
<property name="unzipped"/>
<property name="weburl"/>
</property>
<property name="repdefs" view="_minimal">
<property name="printer"/>
<property name="repnum"/>
<property name="reporder"/>
<property name="report"/>
</property>
<property name="custreps" view="_minimal">
<property name="rep" view="_minimal">
<property name="address1"/>
<property name="address2"/>
<property name="city"/>
<property name="commpcnt"/>
<property name="country"/>
<property name="division"/>
<property name="email"/>
<property name="fax"/>
<property name="phone"/>
<property name="ptid"/>
<property name="state"/>
<property name="zip"/>
<property name="zip4"/>
</property>
<property name="commpcnt"/>
</property>
<property name="custrels" view="_minimal">
<property name="bc" view="_minimal">
<property name="activeflag"/>
<property name="delivcv"/>
<property name="mpemail"/>
<property name="tapestatbkr"/>
</property>
<property name="acctexecflag"/>
<property name="delivcv"/>
<property name="tapestatus"/>
</property>
</view>
<view entity="custfm_Customers" name="rademasters_view" extends="_minimal">
<property name="respschema"/>
</view>
</views>
Please help me make this work. I am missing something simple, I’m sure.