Kurt001
4 May 2011, 6:21 AM
Hi there,
I have a JSON string which I would like to fill into a nested list.
The JSON string looks like this:
?Ext.util.JSONP.callback,stcCallback1001
({
"configuration":
{"data-types":
{"data-type":
[
{"@name":"Quantity","@id":"1","@unit":"1"},
],
"attributes":
[
{"@name":"Attribute","@id":"4"},
]
}
}
})
I would like to fill into a model the following values to show the tree in a nested list:
data-type
attribute
@name
@id
@unit
How would the model need to look like? Currently I have:
Ext.regModel('Model', {
fields: ['data-type','attribute','@name','@id','@unit']
});
How would the store read the JSON string? Currently I have the following which reads the JSON string, but does not sort it the way, that it shows the nested list.
store = new Ext.data.TreeStore({
model: 'Model',
proxy: {
type: 'scripttag',
url : 'http://myWeb/configuration',
callbackParam: 'jsoncallback',,
extraParams: { format: 'json', jsoncallback: 'Ext.util.JSONP.callback' },
reader: {
type: 'json',
root: 'configuration',
record: 'data-types' //still reads the complete JSON string.
}
}
});
Any idea how to get this all into one nested list, which shows in a first list data-type and attribute and in sublists @name @id and if it is there @unit?
Here is my list so far which returns "no items available":
var nestedList = new Ext.NestedList({
fullscreen: true,
title: 'NestedList',
displayField: 'data-types',
store: store
});
I have a JSON string which I would like to fill into a nested list.
The JSON string looks like this:
?Ext.util.JSONP.callback,stcCallback1001
({
"configuration":
{"data-types":
{"data-type":
[
{"@name":"Quantity","@id":"1","@unit":"1"},
],
"attributes":
[
{"@name":"Attribute","@id":"4"},
]
}
}
})
I would like to fill into a model the following values to show the tree in a nested list:
data-type
attribute
@name
@id
@unit
How would the model need to look like? Currently I have:
Ext.regModel('Model', {
fields: ['data-type','attribute','@name','@id','@unit']
});
How would the store read the JSON string? Currently I have the following which reads the JSON string, but does not sort it the way, that it shows the nested list.
store = new Ext.data.TreeStore({
model: 'Model',
proxy: {
type: 'scripttag',
url : 'http://myWeb/configuration',
callbackParam: 'jsoncallback',,
extraParams: { format: 'json', jsoncallback: 'Ext.util.JSONP.callback' },
reader: {
type: 'json',
root: 'configuration',
record: 'data-types' //still reads the complete JSON string.
}
}
});
Any idea how to get this all into one nested list, which shows in a first list data-type and attribute and in sublists @name @id and if it is there @unit?
Here is my list so far which returns "no items available":
var nestedList = new Ext.NestedList({
fullscreen: true,
title: 'NestedList',
displayField: 'data-types',
store: store
});