javavaadinvaadin7unbind

Vaadin FieldGroup unbind


How can i unbind or remove any field from FieldGroup in Vaadin 7.

For example if I am binding a TextField (assume required bean classes are there) like below and want to unbind/remove it for some condition after.

TextField sometextfield= new TextField();
sometextfield.setId("attributeName");   
sometextfield.setNullRepresentation("");
sometextfield.setMaxLength(100);
sometextfield.setWidth("200px");
sometextfield.setCaption("Some text field");
sometextfield.setImmediate(true);
bind(sometextfield, "atextfield");
somelayout.addComponent(sometextfield);

Solution

  • Had you a look at the docu?

    public void unbind(Field<?> field)
                throws FieldGroup.BindException
    

    Detaches the field from its property id and removes it from this FieldBinder.

    Note that the field is not detached from its property data source if it is no longer connected to the same property id it was bound to using this FieldBinder.

    FieldGroup Javadoc