PDA

View Full Version : Radio.setValueAux(String value)



fother
7 Jan 2009, 5:07 AM
If you need set the other value to your com.extjs.gxt.ui.client.widget.form.Radio that isn't the boxLabel.

MyRadio.java


import com.extjs.gxt.ui.client.widget.form.Radio;

public class MyRadio extends Radio {

private String valueAux;

public SfRadio() {

}

/*
* (non-Javadoc)
* @see com.extjs.gxt.ui.client.widget.BoxComponent#afterRender()
*/
@Override
protected void afterRender() {
setNewValue();
}

/**
* Real value of radio.
*
* @return value of radio.
* @since 1.0
*/
public String getValueAux() {
return valueAux;
}

private void setNewValue() {

if (valueAux != null) {

getInputEl().dom.setAttribute("value", valueAux);

}
}

/**
* Set the new value to radio.
*
* @param valueAux new value.
* @since 1.0
*/
public void setValueAux(String valueAux) {
this.valueAux = valueAux;
}

}


Example


public void onModuleLoad() {

FormPanel form = new FormPanel();

final SfRadio radio = new SfRadio();
radio.setName("radio");
radio.setBoxLabel("Red");
radio.setValue(true);
radio.setValueAux("1");

SfRadio radio2 = new SfRadio();
radio2.setName("radio");
radio2.setBoxLabel("Blue");
radio2.setValueAux("2");

RadioGroup radioGroup = new RadioGroup("test");
radioGroup.setFieldLabel("Favorite Color");
radioGroup.add(radio);
radioGroup.add(radio2);
form.add(radioGroup);

RootPanel.get().add(form);

}


History
07/01/09 - Remove the Listener and create an example

fother
18 Feb 2009, 4:51 AM
thanks to implement this.. in 1.2.3 you can see that to combobox this method was added.. setValueAttribute

sven
18 Feb 2009, 5:18 AM
:)