LookUpPickerField not using selected property for value

Hi,

I have added a lookuppickerfield in code using generated column for my table and I don’t receive any errors however it is not using the property which I selected to view in the option instead it is using the entity instance name.

itemsTable.addGeneratedColumn("item", new Table.ColumnGenerator<ReceiptItems>() {
        @Override
        public Component generateCell(ReceiptItems entity) {
            LookupPickerField field = (LookupPickerField) componentsFactory.createComponent(LookupPickerField.NAME);
            field.setCaptionProperty("BARCODE");
            field.setDatasource(itemsTable.getItemDatasource(entity), "item");
            field.setOptionsDatasource(allItemsDs);
            field.addLookupAction();
            field.addOpenAction();
            field.setWidthFull();
            return field;
        }
    });

I have tried using capital letters and small no difference. Also I tried using setCaption and set descriptionProperty no difference in result. This works well when it is just a PickerField using the studio to add options datasource.

Thanks,
Mohamed

Hi!

You should also set caption mode to the field. Try this:

field.setCaptionMode(CaptionMode.PROPERTY);

Hi,

Thanks thats perfect it works now.

Kind regards,
Mohamed