bamato
4 Jan 2011, 2:38 AM
Hello everyone,
We created the following code and we are not able to insert the data from the form into the localstorage.
Any suggestions on how to get this working?
Thanks in advance for your help!
Ext.setup({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function() {
Ext.regModel('Les', {
fields: ['id', 'naam', 'docent', 'lokaal', 'dag', 'uur'],
});
var rooster = new Ext.data.Store({
autoLoad: true,
model: 'Les',
proxy: {
type: 'localstorage',
id : 'rooster'
}
});
var form1 = new Ext.form.FormPanel({
scroll: false,
standardSubmit : false,
items: [{
xtype: 'fieldset',
title: 'Maandag',
items: [{
xtype: 'textfield',
name : 'les1',
label: 'Les 1',
useClearIcon: true,
autoCapitalize : true
}, {
xtype: 'textfield',
name : 'docent1',
label: 'Docent',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'lokaal1',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les2',
label: 'Les 2',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent2',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal2',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les3',
label: 'Les 3',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent3',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal3',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les4',
label: 'Les 4',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent4',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal4',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les5',
label: 'Les 5',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent5',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal5',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les6',
label: 'Les 6',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent6',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal6',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les7',
label: 'Les 7',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent7',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal7',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les8',
label: 'Les 8',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent8',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal8',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les9',
label: 'Les 9',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent9',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal9',
label: 'Lokaal',
useClearIcon: true
}]
}, {
xtype: 'button',
text: 'Opslaan',
ui: 'action',
handler: function(){
vles1 = Ext.ModelMgr.create({
naam: les1,
docent: docent1,
lokaal: lokaal1,
dag: '1',
uur: '1'
}, 'Les');
rooster.add(vles1);
vles2 = Ext.ModelMgr.create({
naam: les2,
docent: docent2,
lokaal: lokaal2,
dag: '1',
uur: '2'
}, 'Les');
rooster.add(vles2);
vles3 = Ext.ModelMgr.create({
naam: les3,
docent: docent3,
lokaal: lokaal3,
dag: '1',
uur: '3'
}, 'Les');
rooster.add(vles3);
vles4 = Ext.ModelMgr.create({
naam: les4,
docent: docent4,
lokaal: lokaal4,
dag: '1',
uur: '4'
}, 'Les');
rooster.add(vles4);
vles5 = Ext.ModelMgr.create({
naam: les5,
docent: docent5,
lokaal: lokaal5,
dag: '1',
uur: '5'
}, 'Les');
rooster.add(vles5);
vles6 = Ext.ModelMgr.create({
naam: les6,
docent: docent6,
lokaal: lokaal6,
dag: '1',
uur: '6'
}, 'Les');
rooster.add(vles6);
vles7 = Ext.ModelMgr.create({
naam: les7,
docent: docent7,
lokaal: lokaal7,
dag: '1',
uur: '7'
}, 'Les');
rooster.add(vles7);
vles8 = Ext.ModelMgr.create({
naam: les8,
docent: docent8,
lokaal: lokaal8,
dag: '1',
uur: '8'
}, 'Les');
rooster.add(vles8);
vles9 = Ext.ModelMgr.create({
naam: les9,
docent: docent9,
lokaal: lokaal9,
dag: '1',
uur: '9'
}, 'Les');
rooster.add(vles9);
rooster.sync();
},
scope: this
}]
});
lessenWeergave = new Ext.Panel({
layout: 'fit',
scroll: 'vertical',
dockedItems: [
{
dock: 'top',
xtype: 'toolbar',
items: [
{
text: 'Laden',
handler: function() {
var panel = lessenWeergave,
dataview = panel.items.first(),
store = 'rooster';
store.load();
}
}
]
}
],
items: [
{
xtype: 'dataview',
/*
* The XTemplate allows us to easily render the data from our User model, as well as
* iterating over each User's Orders and OrderItems:
*/
tpl: [
'<tpl for=".">',
'<div class="user">',
'<h3>{naam}\'s orders:</h3>',
'<tpl for="orders">',
'<div class="order" style="padding-left: 20px;">',
'Order: {id} ({lokaal})',
'<ul>',
'<tpl for="orderItems">',
'<li>{docent} x {naam}</li>',
'</tpl>',
'</ul>',
'</div>',
'</tpl>',
'</div>',
'</tpl>'
],
itemSelector: 'div.user',
styleHtmlContent: true,
store: 'rooster'
}
]
});
var paneelbottom = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
activeTab: 0,
fullscreen: true,
layoutOnTabChange: true,
ui: 'light',
cardSwitchAnimation: {
type: 'fade',
cover: true
},
defaults: {
scroll: 'vertical'
},
items: [{
title: 'Overzicht',
html: '<h1>iClassroom</h1><p>Welkom op de testpagina van iClassroom.</p>',
iconCls: 'home',
cls: 'card1'
}, {
title: 'Lessen',
iconCls: 'rooster-icon',
icon: '../themes/images/default/pictos/calendar2.png',
items: form1,
cls: 'card2',
badgeText: '7',
anchor: '20%'
}, {
title: 'Huiswerk',
html: '<h1>Huiswerk</h1>',
cls: 'card3',
iconCls: 'bookmarks'
}, {
title: 'Projecten',
html: '<h1>Projecten</h1>',
cls: 'card4',
iconCls: 'team',
badgeText: '3'
}, {
title: 'Instellingen',
cls: 'card5',
items: lessenWeergave,
iconCls: 'settings'
}],
});
}
});
We created the following code and we are not able to insert the data from the form into the localstorage.
Any suggestions on how to get this working?
Thanks in advance for your help!
Ext.setup({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function() {
Ext.regModel('Les', {
fields: ['id', 'naam', 'docent', 'lokaal', 'dag', 'uur'],
});
var rooster = new Ext.data.Store({
autoLoad: true,
model: 'Les',
proxy: {
type: 'localstorage',
id : 'rooster'
}
});
var form1 = new Ext.form.FormPanel({
scroll: false,
standardSubmit : false,
items: [{
xtype: 'fieldset',
title: 'Maandag',
items: [{
xtype: 'textfield',
name : 'les1',
label: 'Les 1',
useClearIcon: true,
autoCapitalize : true
}, {
xtype: 'textfield',
name : 'docent1',
label: 'Docent',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'lokaal1',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les2',
label: 'Les 2',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent2',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal2',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les3',
label: 'Les 3',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent3',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal3',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les4',
label: 'Les 4',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent4',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal4',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les5',
label: 'Les 5',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent5',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal5',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les6',
label: 'Les 6',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent6',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal6',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les7',
label: 'Les 7',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent7',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal7',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les8',
label: 'Les 8',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent8',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal8',
label: 'Lokaal',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'les9',
label: 'Les 9',
margin: '10 0 0 0',
useClearIcon: true,
autoCapitalize: true
}, {
xtype: 'textfield',
name : 'docent9',
label: 'Docent',
useClearIcon: true
}, {
xtype: 'textfield',
name : 'lokaal9',
label: 'Lokaal',
useClearIcon: true
}]
}, {
xtype: 'button',
text: 'Opslaan',
ui: 'action',
handler: function(){
vles1 = Ext.ModelMgr.create({
naam: les1,
docent: docent1,
lokaal: lokaal1,
dag: '1',
uur: '1'
}, 'Les');
rooster.add(vles1);
vles2 = Ext.ModelMgr.create({
naam: les2,
docent: docent2,
lokaal: lokaal2,
dag: '1',
uur: '2'
}, 'Les');
rooster.add(vles2);
vles3 = Ext.ModelMgr.create({
naam: les3,
docent: docent3,
lokaal: lokaal3,
dag: '1',
uur: '3'
}, 'Les');
rooster.add(vles3);
vles4 = Ext.ModelMgr.create({
naam: les4,
docent: docent4,
lokaal: lokaal4,
dag: '1',
uur: '4'
}, 'Les');
rooster.add(vles4);
vles5 = Ext.ModelMgr.create({
naam: les5,
docent: docent5,
lokaal: lokaal5,
dag: '1',
uur: '5'
}, 'Les');
rooster.add(vles5);
vles6 = Ext.ModelMgr.create({
naam: les6,
docent: docent6,
lokaal: lokaal6,
dag: '1',
uur: '6'
}, 'Les');
rooster.add(vles6);
vles7 = Ext.ModelMgr.create({
naam: les7,
docent: docent7,
lokaal: lokaal7,
dag: '1',
uur: '7'
}, 'Les');
rooster.add(vles7);
vles8 = Ext.ModelMgr.create({
naam: les8,
docent: docent8,
lokaal: lokaal8,
dag: '1',
uur: '8'
}, 'Les');
rooster.add(vles8);
vles9 = Ext.ModelMgr.create({
naam: les9,
docent: docent9,
lokaal: lokaal9,
dag: '1',
uur: '9'
}, 'Les');
rooster.add(vles9);
rooster.sync();
},
scope: this
}]
});
lessenWeergave = new Ext.Panel({
layout: 'fit',
scroll: 'vertical',
dockedItems: [
{
dock: 'top',
xtype: 'toolbar',
items: [
{
text: 'Laden',
handler: function() {
var panel = lessenWeergave,
dataview = panel.items.first(),
store = 'rooster';
store.load();
}
}
]
}
],
items: [
{
xtype: 'dataview',
/*
* The XTemplate allows us to easily render the data from our User model, as well as
* iterating over each User's Orders and OrderItems:
*/
tpl: [
'<tpl for=".">',
'<div class="user">',
'<h3>{naam}\'s orders:</h3>',
'<tpl for="orders">',
'<div class="order" style="padding-left: 20px;">',
'Order: {id} ({lokaal})',
'<ul>',
'<tpl for="orderItems">',
'<li>{docent} x {naam}</li>',
'</tpl>',
'</ul>',
'</div>',
'</tpl>',
'</div>',
'</tpl>'
],
itemSelector: 'div.user',
styleHtmlContent: true,
store: 'rooster'
}
]
});
var paneelbottom = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
activeTab: 0,
fullscreen: true,
layoutOnTabChange: true,
ui: 'light',
cardSwitchAnimation: {
type: 'fade',
cover: true
},
defaults: {
scroll: 'vertical'
},
items: [{
title: 'Overzicht',
html: '<h1>iClassroom</h1><p>Welkom op de testpagina van iClassroom.</p>',
iconCls: 'home',
cls: 'card1'
}, {
title: 'Lessen',
iconCls: 'rooster-icon',
icon: '../themes/images/default/pictos/calendar2.png',
items: form1,
cls: 'card2',
badgeText: '7',
anchor: '20%'
}, {
title: 'Huiswerk',
html: '<h1>Huiswerk</h1>',
cls: 'card3',
iconCls: 'bookmarks'
}, {
title: 'Projecten',
html: '<h1>Projecten</h1>',
cls: 'card4',
iconCls: 'team',
badgeText: '3'
}, {
title: 'Instellingen',
cls: 'card5',
items: lessenWeergave,
iconCls: 'settings'
}],
});
}
});