PDA

View Full Version : Fill form with record data



martinbroos
15 Jun 2011, 11:34 PM
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



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;
}

heringsfilet
4 Aug 2011, 3:31 AM
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)

Mthor
4 Aug 2011, 8:41 AM
maybe try to load your form with

form.loadRecord(rec);