Hi, i’m trying to connect a “KeyValueEntity” dataset to a TextField but in designtime i can’t set the property field. Anyway when i tryed from runtime using “setValueSource” method i can see the value assigned to the dataset but it is read only. others properties from the dataset that are not datatype worked well. Take a look to these lines:
Note: The dataset name is “lugarEntregaDc”
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.company.caerp.web.comprobante">
<data>
<keyValueInstance id="lugarEntregaDc">
<properties idProperty="id">
<property name="id" datatype="uuid"/>
<property name="vendedor" class="com.company.caerp.entity.Persona"/>
<property name="vehiculo1" class="com.company.caerp.entity.Bien"/>
<property name="vehiculo2" class="com.company.caerp.entity.Bien"/>
<property name="cot" datatype="string"/>
<property name="cliente" class="com.company.caerp.entity.Cliente"/>
<property name="provincia" class="com.company.caerp.entity.Provincia"/>
</properties>
<loader id="lugarEntregaLc">
<query>
<![CDATA[select e]]>
</query>
</loader>
</keyValueInstance>
<collection id="personaeDc" class="com.company.caerp.entity.Persona" view="_local">
<loader id="personaeDl">
<query>
<![CDATA[select e from caerp$Persona e ]]>
</query>
</loader>
</collection>
<collection id="clientesDc" class="com.company.caerp.entity.Cliente" view="_local">
<loader id="clientesDl">
<query>
<![CDATA[select e from caerp$Cliente e ]]>
</query>
</loader>
</collection>
<collection id="provinciasDc" class="com.company.caerp.entity.Provincia" view="_local">
<loader id="provinciasDl">
<query>
<![CDATA[select e from caerp$Provincia e ]]>
</query>
</loader>
</collection>
<instance id="comprobanteTransporteDc" class="com.company.caerp.entity.ComprobanteTransporte">
<loader id="comprobanteTransporteDl"/>
</instance>
</data>
<actions>
<action id="ok"
invoke="onOk"/>
<action id="cancel"
invoke="onCancel"/>
</actions>
<dialogMode height="400"
width="700" forceDialog="true"/>
<layout expand="scrollBox" spacing="true">
<scrollBox id="scrollBox" spacing="true">
<form id="form" dataContainer="lugarEntregaDc">
<column width="250px">
<label icon="LIST" stylename="h2 bold" value="Informacion General:"/>
<lookupPickerField id="vendedorLEField" caption="msg://Vendedor LE"
optionsContainer="personaeDc" property="vendedor">
<actions>
<action id="lookup" type="picker_lookup"/>
<action id="open" type="picker_open"/>
</actions>
</lookupPickerField>
<lookupPickerField id="clienteLEField" caption="msg://Cliente LE"
optionsContainer="clientesDc" property="cliente"/>
<lookupPickerField id="provinciaLEField" caption="msg://Provincia LE"
optionsContainer="provinciasDc" captionProperty="nombre"
dataContainer="lugarEntregaDc" property="provincia"/>
<textField id="cotLEField" maxLength="0" dataContainer="lugarEntregaDc"/>
<textField id="observacionLEField" width="342px" height="73px"
caption="msg://Observacion LE" />
</column>
</form>
</scrollBox>
<hbox id="editActions" spacing="true">
<button id="okBtn"
action="ok"
caption="mainMsg://actions.Ok"/>
<button id="cancelBtn"
action="cancel"
caption="mainMsg://actions.Cancel"/>
</hbox>
</layout>
</window>
Here load values:
@Install(to = "lugarEntregaLc", target = Target.DATA_LOADER)
private KeyValueEntity lugarEntregaLcLoadDelegate(ValueLoadContext valueLoadContext) {
KeyValueEntity keyValueEntity = new KeyValueEntity();
keyValueEntity.setValue("id", UUID.randomUUID());
keyValueEntity.setValue("vendedor", null);
keyValueEntity.setValue("cliente", getCliente());
keyValueEntity.setValue("provincia", getProvincia());
keyValueEntity.setValue("vehiculo1", null);
keyValueEntity.setValue("vehiculo2", null);
keyValueEntity.setValue("cot", "00000000");
return keyValueEntity;
}
In design time i can’t view the properties options list.
In runtime i tryed this one (it worked for me in collections values datasets but here gave me some bugs):
let me clarify this point, the others fields works properly!.
Best regards