PDA

View Full Version : Nested List working for JSON key called "text", but nothing else



garkelly
14 Sep 2011, 1:45 AM
Hi,
New to this.
Took the Music Nested List example and changed it to read in a different JSON File.
Managed to get it working eventually reading this JSON:


{
"likeLinks": [
{
"text": "Search for a share",
"link": "test.html"
},
{
"text": "View Portfolio",
"link": "test.html"
},
........


It shows the list of "text" values.

But if I then try to read:


{
"hateLinks": [
{
"message": "Search for a shares",
"link": "test.html"
},
{
"message": "View my Portfolio",
"link": "test.html"
},
.....


and it shows the correct number of columns, but no text is displayed. Does the "key" have to be called "text" for it to display?

This is my music_store.js file (changed the root text from likeLinks to hateLinks depending on which list I wish to show):


NestedListDemo.music_store = new Ext.data.TreeStore({
model: 'ListItem',
proxy: {
type: 'ajax',
url: 'http://localhost/myapp/pv/pagebean.json',
reader: {
type: 'tree',
root: 'hateLinks'
}
}
});




Thanks

tomalex0
14 Sep 2011, 8:43 PM
use getItemTextTpl in nested list which returns a template with values you want

garkelly
15 Sep 2011, 1:21 AM
Thanks tomalex0, that worked a treat. I can now control what to display in my nestedlist.