creator
3 May 2011, 3:59 AM
Hello guys,
i am in trouble with some code. My idea is to load list entries with AJAX.
My Code:
Ext.setup({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function() {
phome = new Ext.Panel({
html: '<p id="home-headline">Sencha</p><p id="home-content">Eine kleine Testapplikation</p>'
});
function showRecent() {
Ext.Ajax.request({
url: './get_text.php',
success: function(e) {
var obj = Ext.util.JSON.decode(e.responseText);
var guests = obj.guests;
if (guests) {
var html = tpl.applyTemplate(guests);
Ext.getCmp('recentTab').update(html);
}
}
});
}
// store with data
var data = {
text: 'Sencha',
items: [{
text: 'smsvongesternnacht',
items: [ {
id: 'recentTab',
listeners: {
'beforeshow': showRecent
}
}]
},{
text: 'Empty Category',
items: []
}]
};
Ext.regModel('ListItem', {
fields: [{name: 'text', type: 'string'}]
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
var ptut = new Ext.NestedList({
fullscreen: true,
title: 'Pages',
displayField: 'text',
store: store
});
new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
fullscreen: true,
ui: 'dark',
cardSwitchAnimation: {
type: 'slide',
cover: true
},
defaults: {
scroll: 'vertical'
},
items: [{
title: 'Home',
items: [phome],
iconCls: 'home',
cls: 'card1'
}, {
title: 'pages',
items:[ptut],
iconCls: 'favorites',
cls: 'card2',
badgeText: '4'
}
]
});
}
});
On loading the list entry, i got an error (sencha-touch.js):
"sencha-touch.js:6: Uncaught Error: You are using a ServerProxy but have not supplied it with a url".
Did anyone know a solution?
greets
i am in trouble with some code. My idea is to load list entries with AJAX.
My Code:
Ext.setup({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function() {
phome = new Ext.Panel({
html: '<p id="home-headline">Sencha</p><p id="home-content">Eine kleine Testapplikation</p>'
});
function showRecent() {
Ext.Ajax.request({
url: './get_text.php',
success: function(e) {
var obj = Ext.util.JSON.decode(e.responseText);
var guests = obj.guests;
if (guests) {
var html = tpl.applyTemplate(guests);
Ext.getCmp('recentTab').update(html);
}
}
});
}
// store with data
var data = {
text: 'Sencha',
items: [{
text: 'smsvongesternnacht',
items: [ {
id: 'recentTab',
listeners: {
'beforeshow': showRecent
}
}]
},{
text: 'Empty Category',
items: []
}]
};
Ext.regModel('ListItem', {
fields: [{name: 'text', type: 'string'}]
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
var ptut = new Ext.NestedList({
fullscreen: true,
title: 'Pages',
displayField: 'text',
store: store
});
new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
fullscreen: true,
ui: 'dark',
cardSwitchAnimation: {
type: 'slide',
cover: true
},
defaults: {
scroll: 'vertical'
},
items: [{
title: 'Home',
items: [phome],
iconCls: 'home',
cls: 'card1'
}, {
title: 'pages',
items:[ptut],
iconCls: 'favorites',
cls: 'card2',
badgeText: '4'
}
]
});
}
});
On loading the list entry, i got an error (sencha-touch.js):
"sencha-touch.js:6: Uncaught Error: You are using a ServerProxy but have not supplied it with a url".
Did anyone know a solution?
greets