Setting up field 100% of a fieldgroup when created programatically

Hi,
I have this field created programmatically.

@Override
public void init(Map<String, Object> params) {
    super.init(params);

    FieldGroup.FieldConfig fieldConfig = fieldGroup.createField("medium");

    SearchPickerField pickerField = componentsFactory.createComponent(SearchPickerField.class);
    pickerField.setOptionsDatasource(this.mediumEntitiesDs);
    pickerField.addLookupAction();
    pickerField.addOpenAction();
    pickerField.setCaption("Medium");
    pickerField.setDatasource(this.campaignEntityDs,"medium");
    fieldConfig.setComponent(pickerField);
    this.fieldGroup.addField(fieldConfig);
}

Do you know how to set the width 100%? because setWidth("100%") not working.
should I create the field inside the column and set the column to 100% width (programmatically)?
if so, how? I don’t see it in the documentation.

Thanks

Hi!
When you set the component to FieldConfig it applies declarative defaults for a custom field. To use only custom settings of a component you can do the following:

SearchPickerField pickerField = componentsFactory.createComponent(SearchPickerField.class);
pickerField.setWidth("100%");
...
fieldConfig.setComponent(pickerField, FieldAttachMode.CUSTOM);

Hi @Pinyazhin ,
Thank you. but still this wont stretch after applying what you wrote:
image

Thanks

Could you provide a sample project where it reproduced or code of your XML layout and its controller?