I follow a CustomGrid_ContentManager From an SGGraph Example. Here Below the Function for getting content from the feed.
sub GetContent()
feed = ReadAsciiFile("pkg:/images/Response.json")
if feed.Len() > 0
json = ParseJson(feed)
if json <> invalid and json.rows <> invalid and json.rows.Count() > 0
rootChildren = {
children: []
}
for each row in json.rows
if row.items <> invalid
rowAA = {
children: []
}
for each item in row.items
rowAA.children.Push(item)
end for
rowAA.Append({ title: row.title })
rootChildren.children.Push(rowAA)
end if
end for
m.top.content.Update(rootChildren)
end if
end if
end sub
And I access the response using the MainScene like below :
m.grid.content.GetChild(0).GetChild(0)
Here, I'm trying to Add a one more child in GetContent() and access using in main scene like below.
m.grid.content.GetChild(0).GetChild(0).GetChild(0)
But no luck. It's everytime found invalid Data. I'm trying using the below code for . Does anyone give a suggestion how to do this?
sub GetContent()
feed = ReadAsciiFile("pkg:/images/Response.json")
if feed.Len() > 0
json = ParseJson(feed)
if json <> invalid and json.rows <> invalid and json.rows.Count() > 0
rootChildren = {
children: []
}
' 'First Way Here I added extra Node
' rowNode = {
' children: []
' }
' 'Second Way Here I added extra Node
' rootChildren = {
' children: {
' rowNode : []
' }
' }
for each row in json.rows
if row.items <> invalid
rowAA = {
children: []
}
for each item in row.items
'First way using a for loop
' for each nik in item.items
' rowNode.children.Push(nik)
' end for
' rowAA.children.Push(rowNode) ' But Here not maintain item value for first node
' 'Second way I tried with directly addd
' rootChildren.children.rowNode.Push(item.items) 'But here It's give and error
rowAA.children.Push(item)
end for
rowAA.Append({ title: row.title }) 'Here Second Way It's give a error not update data here
rootChildren.children.Push(rowAA)
end if
end for
m.top.content.Update(rootChildren)
end if
end if
end sub