1. #1
    Ext User
    Join Date
    May 2009
    Posts
    3
    Vote Rating
    0
    anijap is on a distinguished road

      0  

    Default ComboBox - onClick

    ComboBox - onClick


    I have a ComboBox that is used as a field where the user can type in a search.
    Once the search results come back, the ComboBox is expanded and suggestions are shown.

    If the user does not want to click on any of the suggestions, he/she should be able to type something into the ComboBox instead.

    The only way this is possible is if the user clicks somewhere outside the area of the ComboBox (and the box is collapsed).

    Is there an
    Code:
    onClick
    method or something similar where I can detect that the user has clicked in the typing area of the ComboBox so that I can collapse the suggestions?

    Thanks in advance for any info!

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Add a click handler to the Element

    After it has been rendered obviously.

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    THis is so common, I've added some info to the docs. With example code:

    Code:
    // Plugin is configured with a listeners config object.
    // The Component is appended to the argument list of all handler functions.
    Ext.DomObserver = Ext.extend(Object, {
        constructor: function(config) {
            this.listeners = config.listeners ? config.listeners : config;
        },
    
        init: function(c) {
            var p, l = this.listeners;
            for (p in l) {
                if (Ext.isFunction(l[p])) {
                    l[p] = this.createHandler(l[p], c);
                } else {
                    l[p].fn = this.createHandler(l[p].fn, c);
                }
            }
            c.render = c.render.createSequence(function() {
                c.el.on(l);
            });
        },
    
        createHandler: function(fn, c) {
            return function(e) {
                fn.call(this, e, c);
            };
        }
    });
    
    var combo = new Ext.form.ComboBox({
    
    // Collapse combo when its element is clicked on
        plugins: [ new Ext.DomObserver({
            click: function(evt, comp) {
                comp.collapse();
            }
        })],
        store: myStore,
        typeAhead: true,
        mode: 'local',
        triggerAction: 'all'
    });

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."