1. #1
    Sencha Premium Member
    Join Date
    Jan 2008
    Posts
    109
    Vote Rating
    8
    KajaSheen is on a distinguished road

      0  

    Default Ext.ux.form.field.DisplayComboBox DisplayField with Mapping to Store

    Ext.ux.form.field.DisplayComboBox DisplayField with Mapping to Store


    Once again a little thing I needed for my application and wanted to share with you. I use a FormPanel with a whole lot of DisplayFields for a quick preview of my records. Now I had a field that usually is filled with a ComboBox, so the value and the actual expected string to display differ. Alas I extended the ComboBox to utilize the value lookup, but mixed in the DisplayField properties.

    Is maybe not throughly tested, but maybe you guys find some bugs or improvements.

    PHP Code:
    Ext.define('Ext.ux.form.field.DisplayComboBox', {
        
    extend:'Ext.form.field.ComboBox',
        
    alias'widget.displaycomboboxfield',
           
        
    htmlEncodefalse,

        
    componentLayout'field',
        
        
    fieldSubTpl: [
            
    '<div id="{id}"',
            
    '<tpl if="fieldStyle"> style="{fieldStyle}"</tpl>'
            
    ' class="{fieldCls}">{value}</div>',
            {
                
    compiledtrue,
                
    disableFormatstrue
            
    }
        ],    

        
    submitValuefalse,
        
        
    /**
         * @cfg {String} [fieldCls="x-form-display-field"]
         * The default CSS class for the field.
         */
        
    fieldClsExt.baseCSSPrefix 'form-display-field',    
        
        
    onRender: function() {
            var 
    me this;

            
    Ext.form.field.Base.prototype.onRender.apply(mearguments);
            
    me.doc Ext.getDoc();
        },
        
        
    validateOnChangefalse,

        
    initEventsExt.emptyFn,

        
    submitValuefalse,
        
        
    isDirty: function(){
            return 
    false;
        },

        
    isValid: function() {
            return 
    true;
        },

        
    validate: function() {
            return 
    true;
        },    
            
        
    getSubTplData: function() {
            var 
    ret this.callParent(arguments);

            
    ret.value this.getDisplayValue();

            return 
    ret;
        },
        
        
    getSubTplMarkup: function() {
            return 
    this.getTpl('fieldSubTpl').apply(this.getSubTplData());
        },
        
        
    getRawValue: function() {
            return 
    this.rawValue;
        },

        
    setRawValue: function(value) {
            var 
    me this,
                
    display;
                        
            
    value Ext.value(value'');
            
    me.rawValue value;
            if (
    me.rendered) {
                
    me.inputEl.dom.innerHTML me.getDisplayValue();
                
    me.updateLayout();
            }
            return 
    value;
        }
        
    }); 
    Quick example:
    PHP Code:
    Ext.require([
        
    'Ext.form.*'
    ]);

    Ext.onReady(function() {

        var 
    formPanel Ext.create('Ext.form.Panel', {
            
    frametrue,
            
    title'Form Fields',
            
    width340,
            
    bodyPadding5,

            
    fieldDefaults: {
                
    labelAlign'left',
                
    labelWidth90,
                
    anchor'100%'
            
    },

            
    items: [{
                
    xtype:"displaycomboboxfield",
                
    queryMode:"local",
                
    valueField:"value",
                
    value2,
                
    store:{
                    
    xtype:"store",
                    
    fields:[
                        {
    name:"text"},
                        {
    name:"value"}
                    ],
                    
    data:[
                          {
    text:"High",value:3},
                          {
    text:"Medium",value:2},
                          {
    text:"Low",value:1}
                      ]
                },
                
    fieldLabel:"Priority",
                
    name:"prio"
            
    }]
        });

        
    formPanel.render('form-ct');

    }); 
    Screenshot:
    displaycombobox.png

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Thank you for the contribution.

    Scott.

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..." hd porno faketaxi