gp40
24 Jan 2011, 9:00 AM
I'm trying to piece together what I need to know to develop an app. Right out of the gate I'm having an issue loading data into a form. When I run my application I don't get any data in my form. My confidence is shaken....can someone give me a little push in the right direction? Thanks /Greg
Code:
var opp = Ext.regModel('Opp', {
fields: [
{name: 'first', type: 'string'},
{name: 'last', type: 'string'}
]
});
var _opp_data = new Ext.data.Store({
model: 'Opp',
autoLoad: true,
listeners: {
load: function(store, records, options){
alert('Records loaded: ' + records.length);
},
loadexception: function(proxy, options, response, e){
alert('Error occurred: ' + e);
}
},
proxy: {
type: 'ajax',
url: '/Sencha/data.json',
reader: {
type: 'json'
}
}
})
var formBase = new Ext.form.FormPanel( {
scroll: 'vertical',
url: 'index.jsp',
standardSubmit: 'false',
xtype: 'fieldset',
title: 'Personal Info',
instructions: 'Please enter the information above.',
defaults: {
required: true,
labelAlign: 'left',
labelWidth: '40%'
},
items:[{
xtype: 'textfield',
name: 'first',
label: 'First Name',
autoCapitalize : true,
required: true,
useClearIcon: true
}, {
xtype: 'textfield',
name: 'last',
label: 'Last Name',
useClearIcon: true
}]
});
new Ext.Application ({
name: 'Post',
launch: function() {
new Ext.TabPanel({
fullscreen: true,
dockedItems: [{ xtype:'toolbar', title: 'Hello World'}],
items: [
{title: 'hello'}, // first tab
formBase
]
})
formBase.load(opp);
}
});
JSON data:
{
"first": "Greg",
"last": "Preston"
}
Code:
var opp = Ext.regModel('Opp', {
fields: [
{name: 'first', type: 'string'},
{name: 'last', type: 'string'}
]
});
var _opp_data = new Ext.data.Store({
model: 'Opp',
autoLoad: true,
listeners: {
load: function(store, records, options){
alert('Records loaded: ' + records.length);
},
loadexception: function(proxy, options, response, e){
alert('Error occurred: ' + e);
}
},
proxy: {
type: 'ajax',
url: '/Sencha/data.json',
reader: {
type: 'json'
}
}
})
var formBase = new Ext.form.FormPanel( {
scroll: 'vertical',
url: 'index.jsp',
standardSubmit: 'false',
xtype: 'fieldset',
title: 'Personal Info',
instructions: 'Please enter the information above.',
defaults: {
required: true,
labelAlign: 'left',
labelWidth: '40%'
},
items:[{
xtype: 'textfield',
name: 'first',
label: 'First Name',
autoCapitalize : true,
required: true,
useClearIcon: true
}, {
xtype: 'textfield',
name: 'last',
label: 'Last Name',
useClearIcon: true
}]
});
new Ext.Application ({
name: 'Post',
launch: function() {
new Ext.TabPanel({
fullscreen: true,
dockedItems: [{ xtype:'toolbar', title: 'Hello World'}],
items: [
{title: 'hello'}, // first tab
formBase
]
})
formBase.load(opp);
}
});
JSON data:
{
"first": "Greg",
"last": "Preston"
}