View Full Version : Multi Layered json and lists?

1 May 2011, 10:10 PM
Hi all,

I've been trying to load a multilayered json feed:

{ "markets": [ {
"selections": [
"selections": [

from my understanding I can load this with somthing like:

Ext.regModel('Markets', {
fields: ['marketname'],
hasMany: {model: 'Selections', name: 'selections'}

Ext.regModel('Selections', {
fields: ['name'],
belongsTo: 'Markets'

var store = new Ext.data.JsonStore({
model : 'Markets',
sorters: 'marketname',
getGroupString : function(record) {
return record.get('marketname');
proxy: {
type: 'ajax',
url : 'json.php',
reader: {
type: 'json',
root: 'markets'

var list = new Ext.List({
itemTpl : '{marketname}',
grouped : true,
indexBar: false,
xtype: 'list',
store: store

So, you can see from the above code I'm basically making a list, but what I want to do is show the data so that it is grouped by the marketnames

somthing like:

-> B
-> C
-> E
-> F

I'm basically totally in over my head, and from teh doco I have read it seems that the json it to complex for a simple store?
If anyone can give me some pointers in getting the json above into a list that is groupable and sortable that would be great, the preference would be to get the regModel looking like:

Ext.regModel('Markets', {
fields: ['marketname','name'],

so there would be:


This I can sort much easier on the first field etc.