1
votes

Hi i have an Extjs 4 form that i want to fill with a record of my store.

Here is the model:

Ext.define('Policy', {
    extend: 'Ext.data.Model',
    fields: [
        {name:'policyName', type:'string'},
        {name:'description', type:'string'},
        {name:'agreement', type:'string'}
    ]
});

And here is the htmleditor field:

{
xtype: 'htmleditor',
fieldLabel : 'Agreement',
name: 'agreement'
}

When the form is shown i call to the loadRecord method in order to fill the fields. The name and description policy fields are correctly filled but the agreement field is not filled. This is the way i fill the fields:

var record = store.findRecord('policyName', policyName);
formPanel.getForm().setValues(record.data);

If i have the agreement field as a textfield it works ok, but i need an advanced view of this text because it is in html format. Does anybody know how to fill the htmleditor field? Additionally... is it possible to view the html in raw mode on this field?

1

1 Answers

0
votes

You could also do it this way and I know it works since I use it.

Ext.getCmp('formpanel').getForm().setValues(record.data);

Assuming you have one record you're trying to load and the name of the fields in the model match the name of the form fields.