PDA

View Full Version : [CLOSED] ReadOnly does not prevent from editing a ComboBox value



cyChop
16 Dec 2010, 6:21 AM
Hi!

Little glitch we found by chance...

The ReadOnly attribute does not take all controls into account for ComboBoxes. When ReadOnly, it is still possible to make the droplist expand and select a new value by using the arrows on the keyboard (down to expand, then navigate with arrows, and return to select value).

No problem when the field is disabled, though, but it cannot be focused, so I don't know if it helps.

Still here if I can provide more intel, but I think I've already given all I could.


GXT version: 2.1
Bug was discovered in web mode, host mode was not tested.
Browser: FireFox 3.6.13
OS: Windows XP SP2
Sample code:

package lu.baloise.ecm.front.client.ui;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.google.gwt.user.client.Element;

public class TestUI extends LayoutContainer {

@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);

// dummy store
List<ModelData> dummies = new ArrayList<ModelData>();
dummies.add(this.dummyModel("Sample 1"));
dummies.add(this.dummyModel("Sample 2"));
dummies.add(this.dummyModel("Sample 3"));
dummies.add(this.dummyModel("Sample 4"));
ListStore<ModelData> store = new ListStore<ModelData>();
store.add(dummies);

// make the comboBox
ComboBox<ModelData> combo = new ComboBox<ModelData>();
combo.setStore(store);
combo.setTriggerAction(TriggerAction.ALL);
combo.setReadOnly(true);
combo.setDisplayField("property");

// adding combo to panel
this.add(combo);
}

public ModelData dummyModel(String str) {
ModelData data = new BaseModelData();
data.set("property", str);
return data;
}
}

sven
16 Dec 2010, 6:26 AM
Quote of ther release notes of 2.1.3 (fix is also part in GXT 2.2.0)


Fixed ComboBox expanding also if readonly set to true under some circumstances.

Also this is a duplicate: http://www.sencha.com/forum/showthread.php?96549-FNR-ComboBox-readonly-problem

cyChop
16 Dec 2010, 6:41 AM
OK, sorry for the duplicate. As for 2.1.3, I didn't even think to check since we use the Maven release (2.1.1). Thanks!