View Full Version : Reading JSON & Writing to a list

11 Jan 2011, 4:03 AM
Hi There,

I'm currently trying to read a JSON file, and it is the first time I've attempted to do something like this - this is the structure of the data:

"data": [
"name": "Mcphabbs",
"category": "Local business",
"location": {
"latitude": 55.865843266667,
"longitude": -4.2768844166667
"id": "128043363914366"

This is the code I'm using to try and read the file with and output the data:

var locationStore = new Ext.data.Store({
model: 'nearbyPlace',
proxy: {
type: 'ajax',
url : '/places-query.json',
reader: {
type: 'json',
root: 'data',
fields: ['name', 'category', 'location', 'latitude', 'longitude', 'id']

var listItems = new Ext.List({
itemTpl : '{name}, {id}',
grouped : false,
indexBar: false,
store: store

var listPanel = new Ext.Panel({
dockedItems: bottomDock,
layout: 'fit',
items: listItems,

var innerPanel = new Ext.Panel({
items: [listPanel],
layout: 'card',
cardSwitchAnimation: {type: 'slide', duration: 100 }

Can anyone guide me as to where I'm going wrong with this?