Results 1 to 9 of 9

Thread: combobox in form

  1. #1
    Sencha User arunjoy's Avatar
    Join Date
    Mar 2012
    Location
    india,kerala,trivandrum
    Posts
    23

    Default combobox in form

    how to add multi select combobox in form as item

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default

    You can have a look at our online example:
    http://dev.sencha.com/deploy/ext-4.0...rm/combos.html

    Code:
    var multiCombo = Ext.create('Ext.form.field.ComboBox', {
        fieldLabel: 'Select multiple states',
        renderTo: 'multiSelectCombo',
        multiSelect: true,
        displayField: 'name',
        width: 500,
        labelWidth: 130,
        store: store,
        queryMode: 'local'
    });
    To add it to a form, use the xtype: 'combo'

    As shown here:
    http://dev.sencha.com/deploy/ext-4.0...eld-types.html

    Regards,
    Scott.

  3. #3
    Sencha User arunjoy's Avatar
    Join Date
    Mar 2012
    Location
    india,kerala,trivandrum
    Posts
    23

    Default

    thank you scottmartin
    combo is not supporting... when giving xtype as combo form panel is not coming

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default

    This should work:

    Code:
    // The data store containing the list of states
    var states = Ext.create('Ext.data.Store', {
        fields: ['abbr', 'name'],
        data : [
            {"abbr":"AL", "name":"Alabama"},
            {"abbr":"AK", "name":"Alaska"},
            {"abbr":"AZ", "name":"Arizona"}
            //...
        ]
    });
    
    Ext.create('Ext.form.Panel', {
    	height: 400,
    	width: 400,
    	renderTo: Ext.getBody(),
    	items: [ 
            {
                xtype: 'combo',
                fieldLabel: 'Choose State',
                store: states,
                queryMode: 'local',
                displayField: 'name',
                valueField: 'abbr'
            } 
        ]
    });
    Regards,
    Scott.

  5. #5
    Sencha User arunjoy's Avatar
    Join Date
    Mar 2012
    Location
    india,kerala,trivandrum
    Posts
    23

    Default

    still same problem except combo everything is working

  6. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default

    Please post your code.

    Regards,
    Scott.

  7. #7
    Sencha User arunjoy's Avatar
    Join Date
    Mar 2012
    Location
    india,kerala,trivandrum
    Posts
    23

    Default code

    Ext.application({
    name: 'Sencha',



    launch: function() {





    Ext.create('Ext.form.Panel', {
    fullscreen:true,
    //renderTo: Ext.getBody(),
    items: [
    {
    xtype: 'textfield',
    name: 'minutes',
    label: 'Minutes'
    }
    ]
    });
    }
    });

    i need combo instead of textfield

  8. #8
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default

    Here is the updated code based on your example: (see attached).
    Please note that if you are running this base example, you will need the renderTo or the screen will be blank.
    If you have this is a larger form that is already rendered, then you can remove it.

    Code:
    var states = Ext.create('Ext.data.Store', {
        fields: ['abbr', 'name'],
        data : [
            {"abbr":"AL", "name":"Alabama"},
            {"abbr":"AK", "name":"Alaska"},
            {"abbr":"AZ", "name":"Arizona"}
        ]
    });
    
    Ext.application({
    	name: 'Sencha',
    	launch: function() {
    		Ext.create('Ext.form.Panel', {
    			fullscreen: true,
    			renderTo: Ext.getBody(),
    			items: [{
    				xtype: 'textfield',
    				name: 'minutes',
    				fieldLabel: 'Minutes'
    			},
    	        {
    	            xtype: 'combo',
    	            fieldLabel: 'Choose State',
    	            store: states,
    	            queryMode: 'local',
    	            displayField: 'name',
    	            valueField: 'abbr'
    	        }]
    		});
    	}
    });
    f194263.png

    Regards,
    Scottt

  9. #9
    Sencha User arunjoy's Avatar
    Join Date
    Mar 2012
    Location
    india,kerala,trivandrum
    Posts
    23

    Default

    thank you for yor reply

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •