PDA

View Full Version : Lists with JSON



borden0108
4 Jul 2011, 2:10 AM
Hey all.

I have been working on my app and have hit a road bump.

i want to have a list that contains the name of a podcast and the date and then when clicked starts the podcast.

it would look something like this for each entry but much smaller
http://redtone.com.au/mobile/tpr/cell.jpg

the entire code can be seen here http://redtone.com.au/mobile/tpr/
but so far the part you need to worry about is below



//This is The area for Varibles that are used later (ie.docked items).
// This is the list for the podcast.
var podcast = new Ext.List({
itemTpl:new Ext.XTemplate([
'<tpl for=".">',
'<div>itemCls</div><div><a href="">link</a></div>',
'</tpl>'
]),
store:new Ext.data.Store({
proxy: new Ext.data.AjaxProxy({
method:'post',
url:'http://redtone.com.au/mobile/tpr/json_datasource.json',
reader:'json'
})
})
});

// the twitter feed.
var twitter = new Ext.List({
itemTpl:new Ext.XTemplate([
'<tpl for=".">',
'<div>Item Description</div><div><a href="">link</a></div>',
'</tpl>'
])
,store:new Ext.data.Store({
proxy: new Ext.data.AjaxProxy({
method:'post',
url:'http://redtone.com.au/mobile/tpr/json_datasource.json', // needs to be json response
reader:'json' // or change this to a custom reader
})
})
});
// this is the base for the the app
var tabpanel = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
fullscreen: true,
ui: 'dark',
sortable: true,
cardSwitchAnimation: {
type: 'fade',
cover: true
},
defaults: {
scroll: 'vertical'
},
items: [{
title: 'Home',
iconCls: 'home',
cls: 'card1',
xtype: 'htmlpage',
url:'home.html',
type: 'fit',
align: 'stretch',
layout:{
type: 'fit',
align: 'stretch'
},
},{
title: 'Radio',
iconCls: 'headphones',
items: [podcast],
cls: 'card2',
xtype: 'Title',
},{
title: 'Twitter',
iconCls: 'twitter2',
items: [twitter],
cls: 'card3',
xtype: 'Title',
},{
title: 'Location',
type: 'fit',
align: 'stretch',
scroll: false,
xtype: 'location',
cls: 'card4',
iconCls: 'locate',
},{
title: 'About',
xtype: 'htmlpage',
url: 'about.html',
// tells this to take up as much room as posible
type: 'fit',
align: 'stretch',
iconCls: 'info',
cls: 'card5',
}]
});
}
});


thanks for your help matt (borden 0108)