Hybrid View

  1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    48
    Vote Rating
    0
    martinbroos is on a distinguished road

      0  

    Default Fill form with record data

    Fill form with record data


    Hi,

    I'm having a tab layout with an form in one of the tabs. I'm sending the data to the view with the updateWithRecord function.

    The data is being received and i can update a template for example. But when it comes to the form is doesn't work. All the names are the same as in the model and i can select the form with my code. It just fails doing the update.

    any suggestions?

    code

    Code:
        items: [
            {
                title: 'Bewerken',
                cls: 'tabBewerken',            
                xtype: 'formpanel',
                id:'pageForm',
                items: [{
    		    	xtype: 'textfield',
    		    	name: 'id',
    		    	label: 'Pagina ID',
    		    	disabled: true            
    		    },{
    		    	xtype: 'togglefield',
    		    	name:  'inMenu',
    		    	label: 'In Menu' 
    		    },
    		    {
    		    	xtype: 'textareafield',
    		    	name: 'title',
    		    	label: 'Pagina Notitie',
    		    	useClearIcon: true
    		    }]
            },
            {
                title: 'Bekijken',
                tpl: '{content}',
                cls: 'tabBekijken'
            },
        ],
        // Update Items with data from model
        updateWithRecord: function(record) 
        {
        	console.log(record.data);
        	
        	//fill form
        	var form = this.items.items[0];
        	form.load(record);
    
    		//update content
    		var content = this.items.items[1];	
    		content.update(record.data.content);
    
            //Update toolbar with title and edit id call
            var toolbar = this.getDockedItems()[0];
            toolbar.setTitle(record.get('title'));
            //toolbar.getComponent('edit').record = record;
        }

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    71
    Vote Rating
    0
    heringsfilet is on a distinguished road

      0  

    Default


    Got the same issue here, using Sencha Touch v1.1.0
    Strange behaviour: In one form it works and in another it doesn't work (nearly same code, just another label on a button)

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2007
    Location
    Moore, Oklahoma
    Posts
    464
    Vote Rating
    13
    Mthor will become famous soon enough

      0  

    Default


    maybe try to load your form with

    form.loadRecord(rec);

Thread Participants: 2