I am using a simple form that I found in the examples. What I want is for the form to be populated with dynamic data when the user opens the form. No buttons, like I saw in the XML demo. I don't know XML, so I am trying to use JSON store. If someone could please help me out. Here is the code I am using:
PHP Code:
Ext.require([
'Ext.form.*',
'Ext.layout.container.Column',
'Ext.tab.Panel'
]);
Ext.onReady(function(){
Ext.define('formModel', {
extend:'Ext.data.Model',
fields: [
{name: 'first', type: 'string'},
{name: 'last', type: 'string'},
{name: 'company', type: 'string'}
]
});
Ext.QuickTips.init();
var bd = Ext.getBody();
/*
* ================ Simple form =======================
*/
bd.createChild({tag: 'h2', html: 'Form 1 - Very Simple'});
var memoryStore = Ext.create('Ext.data.Store',{
model: 'formModel',
proxy: {
type: 'ajax',
url: ('formData.html'),
reader: 'json'
},
autoLoad: true
});
var simple = Ext.create('Ext.form.Panel', {
url:'save-form.php',
frame:true,
title: 'Simple Form',
bodyStyle:'padding:5px 5px 0',
width: 350,
store: memoryStore, //**Store added by me
fieldDefaults: {
msgTarget: 'side',
labelWidth: 75
},
defaultType: 'textfield',
defaults: {
anchor: '100%'
},
items: [{
fieldLabel: 'First Name',
name: 'first',
allowBlank:false
},{
fieldLabel: 'Last Name',
name: 'last'
},{
fieldLabel: 'Company',
name: 'company'
}],
buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
});
simple.render(document.body);
});
And the data,
PHP Code:
[ {"first":"Baba","last":"Booey","company":"JP"} ]
Thank you for any help