Changeset 2603

Show
Ignore:
Timestamp:
02/10/11 14:10:09 (2 years ago)
Author:
ahocevar
Message:

Make combo boxes configurable, e.g. to add an editable: false option. p=fvanderbiest

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extensions/geoext.ux/ux/SimplePrint/lib/GeoExt.ux/SimplePrint.js

    r2557 r2603  
    102102     */ 
    103103    printPage: null, 
    104     
     104 
     105    /** api: config[comboOptions] 
     106     *  ``Object`` Optional options for the comboboxes. If not provided, the 
     107     *  following will be used: 
     108     * 
     109     *  .. code-block:: javascript 
     110     * 
     111     *      { 
     112     *          typeAhead: true, 
     113     *          selectOnFocus: true 
     114     *      } 
     115     */ 
     116    comboOptions: null, 
     117     
    105118    /** private: method[initComponent] 
    106119     */ 
     
    171184        var p = this.printExtent.printProvider; 
    172185        var hideUnique = this.initialConfig.hideUnique !== false; 
    173         !(hideUnique && p.layouts.getCount() <= 1) && this.add({ 
     186        var cbOptions = this.comboOptions || { 
     187            typeAhead: true, 
     188            selectOnFocus: true 
     189        }; 
     190         
     191        !(hideUnique && p.layouts.getCount() <= 1) && this.add(Ext.applyIf({ 
    174192            xtype: "combo", 
    175193            fieldLabel: this.layoutText, 
    176194            store: p.layouts, 
     195            forceSelection: true, 
    177196            displayField: "name", 
    178             typeAhead: true, 
    179197            mode: "local", 
    180             forceSelection: true, 
    181198            triggerAction: "all", 
    182             selectOnFocus: true, 
    183199            plugins: new GeoExt.plugins.PrintProviderField({ 
    184200                printProvider: p 
    185201            }) 
    186         }); 
    187         !(hideUnique && p.dpis.getCount() <= 1) && this.add(
     202        }, cbOptions)); 
     203        !(hideUnique && p.dpis.getCount() <= 1) && this.add(Ext.applyIf(
    188204            xtype: "combo", 
    189205            fieldLabel: this.dpiText, 
    190206            store: p.dpis, 
     207            forceSelection: true, 
    191208            displayField: "name", 
    192             typeAhead: true, 
    193209            mode: "local", 
    194             forceSelection: true, 
    195210            triggerAction: "all", 
    196             selectOnFocus: true, 
    197211            plugins: new GeoExt.plugins.PrintProviderField({ 
    198212                printProvider: p 
    199213            }) 
    200         }); 
    201         !(hideUnique && p.scales.getCount() <= 1) && this.add(
     214        }, cbOptions)); 
     215        !(hideUnique && p.scales.getCount() <= 1) && this.add(Ext.applyIf(
    202216            xtype: "combo", 
    203217            fieldLabel: this.scaleText, 
    204218            store: p.scales, 
     219            forceSelection: true, 
    205220            displayField: "name", 
    206             typeAhead: true, 
    207221            mode: "local", 
    208             forceSelection: true, 
    209222            triggerAction: "all", 
    210             selectOnFocus: true, 
    211223            plugins: new GeoExt.plugins.PrintPageField({ 
    212224                printPage: this.printPage 
    213225            }) 
    214         }); 
     226        }, cbOptions)); 
    215227        this.initialConfig.hideRotation !== true && this.add({ 
    216228            xtype: "numberfield",