1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
    zied jouini is on a distinguished road

      0  

    Default Unanswered: create multiselectfield

    Unanswered: create multiselectfield


    SALAM.
    i try to create a mulit select field here is the code
    Code:
    {
    
    
    xtype: "multiselectfield",
    	
    label: "Instution",
    store: [
    { text : "One" ,   value : "1" },
    { text : "Two" ,   value : "2" },
    { text : "Three" , value : "3" }
    ],
    displayField : "text",
    							
    valueField: "value",
    
    
    name: "multiselect-picker",
    itemType: "picker",
    },
    but it doesnt work.
    how can i fix it?
    thank you

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Try passing in a store instance to see if it will handle a store
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
    zied jouini is on a distinguished road

      0  

    Default


    itried like this
    Code:
    Ext.regApplication({
        name: 'App',
        launch: function()
        {
            alert("Yay, it's working!");
    
    
               
            
            Ext.regModel("Test", {
    	fields : [
    	
    			{ name : "text",  type : "string" },
    	
                            { name : "value", type : "string" }
    ]
    });
    		
    
    
           var store = new Ext.data.Store({
    	model : "Test",
    data  : [
    
    
    { text : "One" , value : "1" },
    				
    { text : "Two" ,   value : "2" },
    			
    { text : "Three" , value : "3" },
    				
    { text : "Four" ,  value : "4" },
    		
    { text : "Five" ,  value : "5" },
    		
    { text : "Six" ,   value : "6" }
    ]
    });
            
    
    
    
    
    var onFieldChange = function(cmp, value) {
    console.log(value);
    }
    		
    var listeners = {
    change: onFieldChange,
    	selectionchange: onFieldChange
    	};
    
    
       	     var form = new Ext.form.FormPanel({
        fullscreen: true,
       cls : 'form',
    	scroll: 'vertical',
        items: [{
                    xtype: 'passwordfield',
                    name: 'password',
                    label: 'Password',
                    useClearIcon: true
                },
    {
                    xtype: 'selectfield',
                    name: 'civilite',
                    label: 'civilite',
                    options: [
                    {
                        text: 'Marie',
                        value: 'Marie'
                    }, 
                    {
                        text: 'Fiance',
                        value: 'Fiance'
                    }, 
                    {
                        text: 'celibataire',
                        value: 'celibataire'
                    }
                             ]
    },
    {
                    xtype: 'textareafield',
                    name: 'bio',
                    label: 'Bio'
                },
    {
                xtype: 'fieldset',
                title: 'Favorite color',
                defaults: {
                    xtype: 'radiofield',
                    labelWidth: '35%'
                },
                items: [{
                    name: 'color',
                    value: 'red',
                    label: 'Red'
                }, {
                    name: 'color',
                    label: 'Blue',
                    value: 'blue'
                }, {
                    name: 'color',
                    label: 'Green',
                    value: 'green'
                }, {
                    name: 'color',
                    label: 'Purple',
                    value: 'purple'
                }]
    },
    {
                    xtype: 'emailfield',
                    name: 'email',
                    label: 'Email',
                    placeHolder: 'me@sencha.com',
                    useClearIcon: true
                },
            {
                xtype: 'textfield',
                name : 'first',
                label: 'First name'
            },
            {
                xtype: 'textfield',
                name : 'last',
                label: 'Last name'
            },
            {
                xtype: 'numberfield',
                name : 'age',
                label: 'Age'
            },
    {
                    xtype: 'checkboxfield',
                    name: 'cool',
                    label: 'Cool'
                },
            {
                xtype: 'urlfield',
                name : 'url',
                placeHolder: 'http://sencha.com',
                label: 'Website'
            },
    {
    	xtype: "datepickerfield",
    	name: "startDate",
    	label: "Start Date",
    	picker: { yearFrom: 1987, yearTo: 2020}  
    },
    
    
    
    
    
    
    {
    
    
    xtype        : "multiselectfield",
    				label        : "Picker**",
    
    
    store        : store,
    			
    displayField : "text",
    	
    valueField   : "value",
    	
    name         : "multiselect-picker",
    		
    itemWidth    : 400,
    	
    itemType     : "picker",
    						listeners    : listeners
    },
    
    
    
    
    {
    	xtype: 'sliderfield',
    	id: "thumb",
    	label: "single thumb",
            listeners: {
    delay: 500,
    afterrender: function(){
    var v=  Ext.getCmp('thumb').getValue();
    Ext.getCmp('val').setValue(v);
    }
    }
    
    
    },
    {
                xtype: 'button',
                flex: 1,
                margin: 10,
                ui: 'round', text: 'Calculate', handler: function()
                       {
                          var v=  Ext.getCmp('thumb').getValue();
                          Ext.Msg.alert("Monthly",v);
                          Ext.getCmp('val').setValue(v);  
                       }
    },
    {
                xtype: 'textfield',
                id : 'val',
                label: 'valeur'    
    },
    {
                xtype: 'button',
                flex: 1,
                margin: 10,
                ui: 'round', text: 'Calculate2', handler: function()
                       {
                          var v=  Ext.getCmp('val').getValue();
                          Ext.getCmp('thumb').setValue(v);  
                       }
    }
        ]
    });
        }
    });
    the form work corectly without the multiselectfield, but when i add it the for don't work

  4. #4
    Sencha User netresource's Avatar
    Join Date
    Oct 2011
    Posts
    23
    Vote Rating
    0
    netresource is on a distinguished road

      0  

    Default


    change
    Code:
    itemType : "picker",
    to
    Code:
    itemType : "list",
    or
    Code:
    itemType : "dataview",

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
    zied jouini is on a distinguished road

      0  

    Default


    thank you for your response.
    i tried "list" and "dataview" but its the same thing.

  6. #6
    Sencha User netresource's Avatar
    Join Date
    Oct 2011
    Posts
    23
    Vote Rating
    0
    netresource is on a distinguished road

      0  

    Default


    try debug with Chrome developer tools and javascript console.