1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    11
    Vote Rating
    0
    zagreberlin is on a distinguished road

      0  

    Default Unanswered: Problem with ComboBox and

    Unanswered: Problem with ComboBox and


    Hi people,

    why the following dont work with combobox?
    If i put only the combox to the formPanel it works but when i put it to the fpItems variable it dont works.
    I dont understand why.

    Code:
    /* on this way it doesnt work. it doesnt work only if the comboBox is in.
       If the combobox is not in it works */
    
    var fpItems =[
    	{		
    		fieldLabel : 'Password',
    		id		   : 'fieldLabel1',
    		allowBlank : false,
    		inputType  : 'password'	// Attribut auf passwort setzen
    	},
    	{
    		fieldLabel : 'File',
    		allowBlank : false,
    		inputType  : 'file'
    	},
    	{	
    		xtype 	   : 'textarea',
    		fieldLabel : 'My TextArea',
    		id         : 'fieldLabel MyTextArea',
    		name 	   : 'myTextArea',
    		anchor 	   : '100%',
    		height     : 100
    	},
    	{
    		xtype 			 : 'numberfield',
    		fieldLabel 		 : 'Numbers only',
    		allowBlank 		 : false,
    		emptyText 		 : 'This field is empty!',
    		decimalPrecision : 3,
    		minValue 		 : 0.001,
    		maxValue 		 : 2
    	},
    	{
    		xtype 		 : 'combobox',
    		fieldLabel   : 'Choose State',
    	        store        : states,
    	       queryMode    : 'local',
    	       displayField : 'name',
    	       valueField   : 'abbr'
    	}
    	];
    
            var fp = new Ext.form.FormPanel({		renderTo 	: Ext.getBody(),
    		id          : 'MyFormPanel',
    		fileUpload  : true,
    		width 		: 400,
    		height 		: 460,
    		title 		: 'Exercising textfields',
    		frame 		: true,
    		bodyStyle 	: 'padding: 6px',
    		labelWidth  : 126,
    		defaultType : 'textfield',
    		defaults 	: {
    			msgTarget : 'side',	
    			qtip	  : 'Min 3 or Max 7 chars',
    			anchor 	  : '-20'
    		},
    		items : fpItems
    	});
    why it works on this way?

    Code:
    var comboBox = {
    		xtype 		 : 'combobox',
    		fieldLabel   : 'Choose State',
    	    store        : states,
    	    queryMode    : 'local',
    	    displayField : 'name',
    	    valueField   : 'abbr'
    }
    
    var fp = new Ext.form.FormPanel({
    		renderTo 	: Ext.getBody(),
    		id          : 'MyFormPanel',
    		fileUpload  : true,
    		width 		: 400,
    		height 		: 460,
    		title 		: 'Exercising textfields',
    		frame 		: true,
    		bodyStyle 	: 'padding: 6px',
    		labelWidth  : 126,
    		defaultType : 'textfield',
    		defaults 	: {
    			msgTarget : 'side',	
    			qtip	  : 'Min 3 or Max 7 chars',
    			anchor 	  : '-20'
    		},
    		items : combobox
    	});
    Please help!

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    11
    Vote Rating
    0
    zagreberlin is on a distinguished road

      0  

    Default


    nobody knows?

  3. #3
    Sencha User
    Join Date
    Sep 2010
    Location
    Netherlands
    Posts
    120
    Answers
    3
    Vote Rating
    4
    aacoro is on a distinguished road

      0  

    Default


    instead of
    store : states,
    please post sample data so the it is faster reproducable...
    I do not see any weird things...

  4. #4
    Ext JS Premium Member christocracy's Avatar
    Join Date
    Oct 2006
    Location
    Montreal
    Posts
    381
    Vote Rating
    0
    christocracy is on a distinguished road

      0  

    Default Unclear

    Unclear


    When you say "doesn't work", what exactly do you mean.

    It's unclear if you mean "the combo doesn't render on-screen" or "when I click the combo, the list contains no items".

    Perhaps a screenshot?
    /**
    * @author Chris Scott
    * @business www.transistorsoft.com
    * @rate $150USD / hr; training $500USD / day / developer (5 dev min)
    *
    * @SenchaDevs http://senchadevs.com/developers/transistor-software
    * @twitter http://twitter.com/#!/christocracy
    * @github https://github.com/christocracy
    */

  5. #5
    Sencha User
    Join Date
    Sep 2010
    Location
    Netherlands
    Posts
    120
    Answers
    3
    Vote Rating
    4
    aacoro is on a distinguished road

      0  

    Default


    Step 1:

    create a HTML page:
    Code:
    <html>
    <head>
    <title>Tespage</title>
        <link href="http://docs.sencha.com/ext-js/4-0/extjs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="http://docs.sencha.com/ext-js/4-0/extjs/bootstrap.js"></script>
        <script type="text/javascript" src="test.js"></script>
    </head>
    <body>
    </body>
    </html>
    Step 2:

    create the test.js in the same folder and copy paste this inside test.js:
    Code:
    Ext.onReady(function () {
        console.log('Ext Js started succesfully.');
    
    
        var states = Ext.create('Ext.data.Store', {
            fields: ['abbr', 'name'],
            data: [{
                "abbr": "AL",
                "name": "Alabama"
            }, {
                "abbr": "AK",
                "name": "Alaska"
            }, {
                "abbr": "AZ",
                "name": "Arizona"
            }]
        });
    
    
        var fpItems = [{
            fieldLabel: 'Password',
            id: 'fieldLabel1',
            allowBlank: false,
            inputType: 'password'
        }, {
            fieldLabel: 'File',
            allowBlank: false,
            inputType: 'file'
        }, {
            xtype: 'textarea',
            fieldLabel: 'My TextArea',
            id: 'fieldLabel MyTextArea',
            name: 'myTextArea',
            anchor: '100%',
            height: 100
        }, {
            xtype: 'numberfield',
            fieldLabel: 'Numbers only',
            allowBlank: false,
            emptyText: 'This field is empty!',
            decimalPrecision: 3,
            minValue: 0.001,
            maxValue: 2
        }, {
            xtype: 'combobox',
            fieldLabel: 'Choose State',
            store: states,
            queryMode: 'local',
            displayField: 'name',
            valueField: 'abbr'
        }];
    
    
        var fp = new Ext.form.FormPanel({
            renderTo: Ext.getBody(),
            id: 'MyFormPanel',
            fileUpload: true,
            width: 400,
            height: 460,
            title: 'Exercising textfields',
            frame: true,
            bodyStyle: 'padding: 6px',
            labelWidth: 126,
            defaultType: 'textfield',
            defaults: {
                msgTarget: 'side',
                qtip: 'Min 3 or Max 7 chars',
                anchor: '-20'
            },
            items: fpItems
        });
    
    
    
    
    });
    this works!

    Pozdrav!

    This my result:

    ComboBox.png
    Last edited by aacoro; 22 Aug 2011 at 12:16 PM. Reason: added printscreen

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Posts
    11
    Vote Rating
    0
    zagreberlin is on a distinguished road

      0  

    Default


    thx aacoro!
    the problem was that the states were under the combobox.

Thread Participants: 2

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..."