mordor
5 Jun 2009, 12:39 AM
Using:
Ext GWT - 1.24
GWT - 1.64
Browsers: IE, FireFox, Chrome. (Safari/Opera not tested)
If in ListStore we set list where DisplayField has the same values, we can select only first of them. If we try to select second one (doesn't matter which, not first) ComboBox set automaticaly on first.
There code example:
ComboBox<ShortSuppliersDO> suppliersList = new ComboBox<ShortSuppliersDO>();
ListStore<ShortSuppliersDO> suppliersStore = new ListStore<ShortSuppliersDO>();
suppliersList.setWidth(250);
suppliersList.setTypeAhead(true);
suppliersList.setTriggerAction(TriggerAction.ALL);
suppliersList.setStore(suppliersStore);
suppliersList.setDisplayField("title");
suppliersList.setValueField("makeId");
suppliersList.setEmptyText("Select name...");
suppliersStore.add(dataList);
public class ShortSuppliersDO extends BaseModel implements Serializable {
private static final long serialVersionUID = -6647635674715251652L;
public ShortSuppliersDO() {
}
public ShortSuppliersDO(Double makerId, String title, String countryId, String type, String selfId) {
set("makerId", makerId);
set("title", title);
set("countryId", countryId);
set("type", type);
set("selfId", selfId);
}
public Double getMakerId() {
return get("makerId");
}
public void setMakerId(Double makerId) {
set("makerId", makerId);
}
public String getTitle() {
return get("title");
}
public void setTitle(String title) {
set("title", title);
}
public String getCountryId() {
return get("countryId");
}
public void setCountryId(String countryId) {
set("countryId", countryId);
}
public String getType() {
return get("type");
}
public void setType(String type) {
set("type", type);
}
public String getSelfId() {
return get("selfId");
}
public void setSelfId(String selfId) {
set("selfId", selfId);
}
}
List<ShortSuppliersDO> dataList = new ArrayList<ShortSuppliersDO>();
ShortSuppliersDO tmp1 = new ShortSuppliersDO(1, "Test1", "UK", "C", "RTK37856");
ShortSuppliersDO tmp2 = new ShortSuppliersDO(2, "Test2", "US", "S", "RTK37352");
ShortSuppliersDO tmp3 = new ShortSuppliersDO(3, "Test1", "NL", "T", "RTK37328");
ShortSuppliersDO tmp4 = new ShortSuppliersDO(4, "Test4", "DE", "U", "RTK37091");
ShortSuppliersDO tmp5 = new ShortSuppliersDO(5, "Test2", "IT", "V", "RTK37381");
dataList.add(tmp1);
dataList.add(tmp2);
dataList.add(tmp3);
dataList.add(tmp4);
dataList.add(tmp5);
Ext GWT - 1.24
GWT - 1.64
Browsers: IE, FireFox, Chrome. (Safari/Opera not tested)
If in ListStore we set list where DisplayField has the same values, we can select only first of them. If we try to select second one (doesn't matter which, not first) ComboBox set automaticaly on first.
There code example:
ComboBox<ShortSuppliersDO> suppliersList = new ComboBox<ShortSuppliersDO>();
ListStore<ShortSuppliersDO> suppliersStore = new ListStore<ShortSuppliersDO>();
suppliersList.setWidth(250);
suppliersList.setTypeAhead(true);
suppliersList.setTriggerAction(TriggerAction.ALL);
suppliersList.setStore(suppliersStore);
suppliersList.setDisplayField("title");
suppliersList.setValueField("makeId");
suppliersList.setEmptyText("Select name...");
suppliersStore.add(dataList);
public class ShortSuppliersDO extends BaseModel implements Serializable {
private static final long serialVersionUID = -6647635674715251652L;
public ShortSuppliersDO() {
}
public ShortSuppliersDO(Double makerId, String title, String countryId, String type, String selfId) {
set("makerId", makerId);
set("title", title);
set("countryId", countryId);
set("type", type);
set("selfId", selfId);
}
public Double getMakerId() {
return get("makerId");
}
public void setMakerId(Double makerId) {
set("makerId", makerId);
}
public String getTitle() {
return get("title");
}
public void setTitle(String title) {
set("title", title);
}
public String getCountryId() {
return get("countryId");
}
public void setCountryId(String countryId) {
set("countryId", countryId);
}
public String getType() {
return get("type");
}
public void setType(String type) {
set("type", type);
}
public String getSelfId() {
return get("selfId");
}
public void setSelfId(String selfId) {
set("selfId", selfId);
}
}
List<ShortSuppliersDO> dataList = new ArrayList<ShortSuppliersDO>();
ShortSuppliersDO tmp1 = new ShortSuppliersDO(1, "Test1", "UK", "C", "RTK37856");
ShortSuppliersDO tmp2 = new ShortSuppliersDO(2, "Test2", "US", "S", "RTK37352");
ShortSuppliersDO tmp3 = new ShortSuppliersDO(3, "Test1", "NL", "T", "RTK37328");
ShortSuppliersDO tmp4 = new ShortSuppliersDO(4, "Test4", "DE", "U", "RTK37091");
ShortSuppliersDO tmp5 = new ShortSuppliersDO(5, "Test2", "IT", "V", "RTK37381");
dataList.add(tmp1);
dataList.add(tmp2);
dataList.add(tmp3);
dataList.add(tmp4);
dataList.add(tmp5);