Generally you have a parent component that launches a task and observes the content (a node field on the task). When the content updates, the parent component sets the content of some component (such as a rowlist or a some other component that takes a content field). Something like m.rowlist.content = m.mytask.content
In this case the task will have received a response from the server (XML or Json, hopefully) then parse that response to turn it into an object that is a single content node with a bunch of child nodes.
make sense?
in the parent component's init() you'd have
sub init()
'set rowlist component'
m.rowlist = m.top.findnode("rowlistId") ' this assumes your XML has a rowlist with id = "rowlistId" '
'setup task component'
m.mytask = createObject("RoSGNode", "GetTask") ' this assumes you have a task component (xml,brs) with name = "GetTask" '
m.mytask.observeField("content","onContentChange")
...
end sub
sub onContentChange()
m.rowlist.content = m.mytask.content
end sub
then later in the parent init, or when the user presses a key, or some other observable event, you launch the task, first passing in any needed params through a field.
m.loadtask.yourField="some_param_value"
m.loadtask.control="RUN"
the GetTask will have a field named "content" and will do something like this with the parsed http response:
yourField = m.top.yourField
urlTransferObject = createObject("roUrlTransfer")
urlTransferObject.SetCertificatesFile("common:/certs/ca-bundle.crt")
urlTransferObject.setUrl(m.url + "?myParam=" + yourField)
response = ParseJson(urlTransferObject.GetToString())
content = createObject("RoSGNode", "ContentNode")
for each item in response
child = content.createChild("Node") 'change node here to component type that matches the rowlists itemComponentName '
child.id = item.id
child.title = item.title
end for
m.top.content = content ' this triggers the parent's observer`
aspiring