1. #1
    Sencha Premium Member
    Join Date
    Jan 2008
    Posts
    105
    Vote Rating
    6
    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,627
    Vote Rating
    399
    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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar