We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47799
    • 3 Posts
    BitSiren - Digital Business Creators Reply #1, 11 years, 6 months ago
    Hello all,

    Might be a simple question, but have not found the answer somewhere. In a custom manager select box, which we populate with data from a custom database, how can we add a static value?

    Example:
    A select box is populated with data from a custom DB:


    • Option 1
    • Option 2
    • Option 3
    • etc.

    But we want to set a static default option like this:


    • None
    • Option 1
    • Option 2
    • Option 3
    • etc.

    Following is the code we are currently using:

    Create.js / Update.js
    {
      fieldLabel: _('xyz.locatedAt')
      ,id: 'listing'
      ,name: 'listing_venue_locatedAt'
      ,hiddenName: 'listing_venue_locatedAt'
      ,url: config.url
      ,xtype: 'xyz-combo-listing'
      ,anchor: '100%'
    }
    


    combo.js

    MODx.combo.Listing = function(config) {
        config = config || {};
        Ext.applyIf(config, {
            baseParams: {
    			action: 'listing/getlist'
    			,sort: 'listing_venue_title'
    			,active: 1
    			,approved: 1
    		}
    		,fields: ['id', 'listing_venue_title']
    		,displayField: 'listing_venue_title'
            ,valueField: 'id'
        });
        MODx.combo.Listing.superclass.constructor.call(this, config);
    };
    


    How can we achieve this?

    Thanks in advance for any hints and tips.

    Adrian