Results 1 to 3 of 3

Thread: Using setValues on form - can't figure it out

  1. #1
    Ext User
    Join Date
    Jul 2009
    Posts
    14
    Vote Rating
    0
      0  

    Default Using setValues on form - can't figure it out

    So I have a form that was largely copy/pasted from an example. I'm new at ExtJS so forgive me if some of the flags and config settings look odd. In any case, I want to fill the data in the form using setValues. Using getValues I can retrieve a map of all the name/value pairs. Now here's the odd thing: if I get the values using getValues(), modify a single property, and write it back using setValues() the form doesn't get updated. It looks like there's either a bug or feature I'm missing that makes checkboxes nested a group not work.

    Code:
    // get values from the form. 
    values = form.getValues();
    // Assume the 'create' checkbox is checked, we'll get something like "values.create='on'"
    console.log(values);
    // now uncheck the checkbox
    values.create = 'off';
    // write back the changed value set. This somehow does not update the checkbox on the screen
    form.getValues(values);
    I've been hacking at this for three full hours but have been unable to come up with a solution/patch. I hope someone here can help me out

    Code:
        // properties form
    	var permissionsForm = new Ext.form.FormPanel (
    	{
    		layout:'fit',
    		autoHeight: true,
    		autoWidth: true,
    		items: [
    	        new Ext.form.FieldSet(
    			{
    				title : 'Permissions',
    			    layout: 'form',
    				autoHeight: true,
    				autoWidth: true,
    			    items: [
    			            // profile combobox
            	            new Ext.form.ComboBox({
                        	    name: 'profile',
            	            	fieldLabel: 'Profile',
            	            	store: [ 'Full control', 'Owner', 'Secretary', 'Only read', 'No rights', 'Other' ],
            	            	displayField: 'name', 
                        	    mode: 'local',
                        	    triggerAction: 'all',
                        	    forceSelection:true,
                        	    selectOnFocus: true
                	    	}),
    			            
    		                new Ext.form.CheckboxGroup({
    			            	name: 'checkboxes',
    		                    hideLabel: true,
    		                    anchor: '95%',
    			                // Distribute controls across 3 even columns, filling each row
    			                // from left to right before starting the next row
    			                columns: 2,
    			                items: [{
    		                    	columnWidth: 0.5,
    		                       	items: [
    		                        	{boxLabel: 'Create items', name: 'create'},
    		                        	{boxLabel: 'Read items', name: 'read'},
    		                        	{boxLabel: 'Create subfolders', name: 'createSubFolders'},
    		                       	]
    		                	}, {
    		                    	columnWidth: 0.5,
    		                    	items: [
    		        	                    {boxLabel: 'Folder permissions', name: 'folderPermissions'},
    		        	                    {boxLabel: 'Folver visible', name: 'folderVisible'}
    		                    	]
    		                	}]
    		                }),
    			                
    		                {
    		                    xtype: 'radiogroup',
    		                    itemCls: 'x-check-group-alt',
    		                    hideLabel: true,
    		                    allowBlank: false,
    		                    anchor: '95%',
    		                    items: [{
    		                        columnWidth: '.5',
    		                        items: [
    		                            {xtype: 'label', text: 'Edit', cls:'x-form-check-group-label', anchor:'-15'},
    		                            {boxLabel: 'None', name: 'edit', inputValue: 1},
    		                            {boxLabel: 'Own', name: 'edit', inputValue: 2},
    		                            {boxLabel: 'Any', name: 'edit', inputValue: 3},
    		                        ]
    		                    },{
    		                        columnWidth: '.5',
    		                        items: [
    		                            {xtype: 'label', text: 'Delete', cls:'x-form-check-group-label', anchor:'-15'},
    		                            {boxLabel: 'None', name: 'delete', inputValue: 1},
    		                            {boxLabel: 'Own', name: 'delete', inputValue: 2},
    		                            {boxLabel: 'Any', name: 'delete', inputValue: 3}
    		                        ]
    		                    }]
    		                }
    	                ]
    			})
            ]
    	});

  2. #2
    Ext User
    Join Date
    May 2009
    Posts
    38
    Vote Rating
    0
      0  

    Default

    I assume you meant to say

    form.setValues(values);

    instead of

    form.getValues(values);


    Not sure why it's not working - you could try creating your own hard-coded object hash or id/value array and call setValues with that object or array and see if the values change in that case.

  3. #3
    Ext User
    Join Date
    Jul 2009
    Posts
    14
    Vote Rating
    0
      0  

    Default

    I tried both, neither work. The problem is that both implementations call findField, which returns null for anything but the combobox.

Posting Permissions

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