1. #1
    Ext User mordor's Avatar
    Join Date
    May 2009
    Posts
    2
    Vote Rating
    0
    mordor is on a distinguished road

      0  

    Exclamation [CLOSED] [1.24] ComboBox value selection

    [CLOSED] [1.24] ComboBox value selection


    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:

    Code:
        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);
    Code:
    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);
        }
    }
    Code:
    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);
    ٩(•̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ ٩(●̮̮̃•̃)۶ ٩(͡๏̯͡๏)۶ ٩(-̮̮̃•̃)۶

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    This is not really a bug. By default only the displayname is checked if they are equal. However having two excat same entries in a dropdown selectbox seems a bit strange. You can extend ComboBox to add some more equal checking.
    I am going to close this.

  3. #3
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    Quote Originally Posted by mordor View Post
    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.
    if what the user told its true.. I believe that is a bug..

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    No it is not. The default comparater only checks for the displayfield. As in a selectbox normally all displayfields are different this is sufficient.

  5. #5
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    Quote Originally Posted by sven View Post
    No it is not. The default comparater only checks for the displayfield. As in a selectbox normally all displayfields are different this is sufficient.
    its a bad design.. should be compare to with the value

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    It is also not a bad design. The current implementation is valid for 99,999999% of all usecases. If you really want two equals values in a drop down (which make totally no sense) than you can add your own comparator.

  7. #7
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    ok.. have different for you.. in your code change to compare with the value?

Thread Participants: 2