1. #1
    Ext User
    Join Date
    Jul 2009
    Posts
    1
    Vote Rating
    0
    anton.dutov is on a distinguished road

      0  

    Default Nullable ComboBox

    Nullable ComboBox


    Extends Ext.form.ComboBox
    Adds new attribute called 'nullable'
    And two events 'clear' (fires when value cleared) and 'change' (fires when value changed)
    if nullable is set to true and some value selected - shows button to clear value
    Event 'change' like event 'select' but no have arguments and fires even when value is cleared


    Code:
    Ext.override(Ext.form.ComboBox, {
        nullable:false
        ,initComponent: Ext.form.ComboBox.prototype.initComponent.createSequence(function(){
            this.triggerConfig = {
                tag:'span', cls:'x-form-twin-triggers', cn:[
                    {tag: "img", src: Ext.BLANK_IMAGE_URL, cls:'x-form-trigger '},
                    {tag: "img", src: Ext.BLANK_IMAGE_URL, cls:'x-form-trigger x-form-clear-trigger'}
            ]};
            this.addEvents(
                'clear',
                'change'
            );
            this.on('select', function(){
                this.nullable && this.trigger_clear.show();
                this.fireEvent('change', this);
            });
        })
        ,clearValue:Ext.form.ComboBox.prototype.clearValue.createSequence(function(){
            if(this.trigger_clear){
                this.trigger_clear.hide();
            }
            this.fireEvent('clear',  this);
            this.fireEvent('change', this);
        })
        ,onRender:Ext.form.ComboBox.prototype.onRender.createSequence(function(ct, position){
            var self = this;
            var triggers = this.trigger.select('.x-form-trigger', true).elements;
            for(var i;i<triggers.length;i++){
                triggers[i].addClassOnOver('x-form-trigger-over');
                triggers[i].addClassOnOver('x-form-trigger-over');
            }
            this.trigger_clear = triggers[1];
            this.trigger_clear.hide = function(){
                var w = self.wrap.getWidth();
                this.dom.style.display = 'none';
                self.el.setWidth(w-self.trigger.getWidth());
            };
            this.trigger_clear.show = function(){
                var w = self.wrap.getWidth();
                this.dom.style.display = '';
                self.el.setWidth(w-self.trigger.getWidth());
            };
            this.mon(this.trigger_clear, 'click', this.clearValue, this, {stopPropagation:true});
            if(!this.getValue())
                this.trigger_clear.hide();
        })
        ,onDestroy : Ext.form.ComboBox.prototype.onDestroy.createInterceptor(function() {
            Ext.destroy(this.triggers);
            return [];
        })
    });
    Attached Images

  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


    The TwinTriggerCombo will allow this very simply.

    http://www.google.com/cse?cx=0017339...ombo&sa=Search

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..."