Results 1 to 3 of 3

Thread: Combobox - fire select event

  1. #1
    Sencha User
    Join Date
    Sep 2009
    Location
    Bangalore, India
    Posts
    7

    Cool Combobox - fire select event

    I have created a combo-box and rendered it. I have also defined the 'select' listener:

    Code:
     
    var returnCombo = new Ext.form.ComboBox({
    fieldLabel: comboLabel,
    id: comboId,
    name: comboId,
    width:250,
    typeAhead: true, 
    triggerAction: 'all',
    editable: false,
    
    lastQuery: '',
    store: comboStore,
    
    displayField: comboDisplay,
    
    triggerAction: 'all',
    emptyText:'Select ' + comboLabel,
    valueNotFoundText: valNotFound,
    selectOnFocus:true,
    mode: 'local',
    valueField: comboValue,
    allowBlank:false
    Code:
    });

    Code:
     
    returnCombo.on('select', function fn (cb, rec, ind) {
     ... some logic ...
    });
    I want to select an item from the code. I used:
    Code:
     
    returnCombo.setValue(selectedVal);
    However, this does not fire the select event. How do I fire it from the code. I know it can be done manually, but I have many combo boxes and need the default values to be set depending on some logic in the code.

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Location
    Bangalore, India
    Posts
    7

    Thumbs up Overriding it

    Found a way to override the setValue function.

    http://www.extjs.com/forum/showthread.php?t=78726

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2013
    Posts
    8

    Default

    I found it more efficient to use onChange instead of onSelect. That one is triggered when you set the value from code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •