PDA

View Full Version : [CLOSED] [1.2.3] TextField<Integer> not binding to BeanModel



The_Jackal
12 Mar 2009, 10:33 PM
Hi,

When I create a textField<Integer> it does not bind to a BeanModel which proxies a POJO with a Integer value.

If I make the generic and the POJO field a String then it works.

OS: WINXP Pro
Affects: Hosted and Non-Hosted

Code - the form:



FormPanel configForm = new FormPanel();

final FormBinding formBinding = new FormBinding(configForm);

final TextField<Integer> numberOfYears = new TextField<Integer>();
numberOfYears.setFieldLabel("Years");
numberOfYears.setName("numberOfYearsInt");

configForm.add(numberOfYears);

formBinding.autoBind();
formBinding.bind(configUnsavedModel);
...
The POJO:



public class APOJO implements IsSerializable
{
private Integer numberOfYearsInt = new Integer(1);

public Integer getNumberOfYearsInt()
{
return numberOfYearsInt;
}

public void setNumberOfYearsInt(Integer numberOfYearsInt)
{
this.numberOfYearsInt = numberOfYearsInt;
}
}
The BeanModel:



@BEAN(APOJO.class)
public interface APOJPBeanModel extends BeanModelMarker {

}

sven
13 Mar 2009, 2:04 AM
Use NumberField instead please

The_Jackal
15 Mar 2009, 11:10 PM
Note that the javadoc for NumberField is wrong - it states:



NumberField<Integer> field = new NumberField<Integer>;
field.setPropertyEdtiorType(Integer.class);
When the correct code is:


NumberField field = new NumberField();
field.setPropertyEdtiorType(Integer.class);
See http://extjs.com/forum/showthread.php?t=62660
Regards,
The Jackal