1. #1
    Ext JS Premium Member
    Join Date
    Aug 2008
    Posts
    8
    Vote Rating
    0
    vraj is on a distinguished road

      0  

    Default how to check the combobox has a particular value

    how to check the combobox has a particular value


    How to check whether a particular text is in the combobox or not?

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    Do you mean selection? ie ComboBox.getSelection();

  3. #3
    Ext GWT Premium Member
    Join Date
    Sep 2008
    Posts
    5
    Vote Rating
    0
    reliagility is on a distinguished road

      0  

    Default unable to get editable combo box text

    unable to get editable combo box text


    I'm having a similar problem.
    So, I have an editable ComboBox. If the user types in a value, how can I get that text? getSelection returns null because nothing in the dropdown area is selected.

    I'm using GXT 1.0.4, and am in the process of buying a commercial license.

    -Mike

  4. #4
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    what does getValue() return?

  5. #5
    Ext GWT Premium Member
    Join Date
    Sep 2008
    Posts
    5
    Vote Rating
    0
    reliagility is on a distinguished road

      0  

    Default re: unable to get editable combo box text

    re: unable to get editable combo box text


    In this case, .getValue() returns null - looks like getValue is using the store, even for an editable combo box with nothing selected (see below, from ComboBox.java):

    Code:
      @Override
      public D getValue() {
        if (store != null) {
          getPropertyEditor().setList(store.getModels());
        }
        return super.getValue();
      }
    maybe there needs to be some checking of the "editable" flag? - not sure exactly how to do this, but, in this case, the user-entered value would not be in the store....



    -Mike

  6. #6
    Ext GWT Premium Member
    Join Date
    Sep 2008
    Posts
    5
    Vote Rating
    0
    reliagility is on a distinguished road

      0  

    Default re: unable to get editable combo box text

    re: unable to get editable combo box text


    But, getRawValue() does work. So, there's a workaround! Yea!

    Thanks,

    -Mike

  7. #7
    Ext JS Premium Member
    Join Date
    Aug 2008
    Posts
    8
    Vote Rating
    0
    vraj is on a distinguished road

      0  

    Default


    I wrote a findMatch to check whether a value exists in Combobox

    findMatch: function(prop, value){
    var match = false;
    if(this.store.getCount() > 0){
    this.store.each(function(r){
    if(r.data[prop] == value){
    match = true;
    }
    });
    }
    return match;
    }

Thread Participants: 2