i have entity FDataTableColumn which has field referenceFieldId which is long type and refs onto id of such column. On the create page i have combobox with list of all columns, i want to chose one and to put its id value to my referenceFieldId. this is my combobox:
<combobox model="@load(fdtcm.fDataTableColumns)" selectedItem="@bind(fdtcm.fDataTableColumn.referenceFieldId)" width="50%">
<template name="model">
<comboitem label="@load(each.table.tableName.concat('.').concat(each.tableField))" value="@bind(each.id)"/>
</template>
</combobox>
Looks like it's all good but i got this exception
Cannot convert FDataTableColumn{id=6, type=STRING, tableField='EMAIL'} of type class ru.webvane.framework.metadata.entity.FDataTableColumn to class java.lang.Long at [file:/E:/apache-tomcat-7.0.28%20(64)/webapps/fw/fw/importData/dataTableColumn/input.zul, line:86]
i understand that my combo is trying to save the whole object to referenceFieldId, but why ? because i'm trying to save object's id
value="@bind(each.id)"
can anyone help me or explain what i'm doing wrong. thank you
SergeBud,
It is possible to do so but as askkuber already points out, the class of what's inside the combobox is the class what will be saved.
Now you just have to implement your own custom converter :
then it should the zul be like :
selectedItem="@bind(fdtcm.fDataTableColumn.referenceFieldId) @converter(fdtcm.myConverter)"