nmaves
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2017
09:23 AM
Dynamically update TargetList / TargetGroup
I have a TargetList that works great. The only issue I am seeing is when I need to refresh the content of that TargetList.
Bellow is how I am updating the content. Here is the use case that I am seeing. Our list is ordered from most recently played to least recently played. Let's say I have 4 titles in the list. I have a timer that runs every 30 seconds to pull the list of titles from our web service and update the TargetList. The user now plays the 4th title in the list. When they come back to the screen with the TargetList on it it has refreshed but the UI is showing that title twice in the target list. It does not appear to refresh properly. It might have to do with some of the tiles being outside of the focus set but I can't be sure.
Is there a proper way to update the content of a TargetList / TargetGroup ?
Bellow is how I am updating the content. Here is the use case that I am seeing. Our list is ordered from most recently played to least recently played. Let's say I have 4 titles in the list. I have a timer that runs every 30 seconds to pull the list of titles from our web service and update the TargetList. The user now plays the 4th title in the list. When they come back to the screen with the TargetList on it it has refreshed but the UI is showing that title twice in the target list. It does not appear to refresh properly. It might have to do with some of the tiles being outside of the focus set but I can't be sure.
Is there a proper way to update the content of a TargetList / TargetGroup ?
m.titlesList.content = m.borrowedTitlesTask.content
7 REPLIES 7
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2017
10:21 AM
Re: Dynamically update TargetList / TargetGroup
based on my experience with other components, I think the best approach will be to loop over each element and update their component contents individually. In other words, overwrite values for "text" and "uri" fields rather than trying to overwrite the whole content in one shot.
Alternatively, create a new targetlist from your new content and replace your initial targetlist (get / set your focus along the way)
hope it may help,
Joe
Alternatively, create a new targetlist from your new content and replace your initial targetlist (get / set your focus along the way)
hope it may help,
Joe
aspiring
nmaves
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2017
11:16 AM
Re: Dynamically update TargetList / TargetGroup
Well, that is something I can try. I also noticed that the items do update if they move outside the targetset and come back in. Strange right?
Though this suggestion is kind of a pain. You have to update existing items or remove them if the new list is smaller than the currently displayed list. Or append them if there are more. It should just work by updating the targetlist.content.
Nathan
Though this suggestion is kind of a pain. You have to update existing items or remove them if the new list is smaller than the currently displayed list. Or append them if there are more. It should just work by updating the targetlist.content.
Nathan
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2017
12:09 PM
Re: Dynamically update TargetList / TargetGroup
yes - you need to remove extra elements or createObject for additional ones.
Yes it is a pain, so was figuring it out by trial and error! Hey man, I didn't write this firmware, just trying to help 🙂
Maybe try my 2nd suggestion, instantiate a new object with your new content and replace the existing?
Yes it is a pain, so was figuring it out by trial and error! Hey man, I didn't write this firmware, just trying to help 🙂
Maybe try my 2nd suggestion, instantiate a new object with your new content and replace the existing?
aspiring
nmaves
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017
07:18 PM
Re: Dynamically update TargetList / TargetGroup
Re-creating the TargetList actually works but you see a pretty bad flicker.
I really wish that the Roku dev team would at least comment on issues like this. I think I have created 10+ posts in the forums and they never seem to contribute.
Nathan
I really wish that the Roku dev team would at least comment on issues like this. I think I have created 10+ posts in the forums and they never seem to contribute.
Nathan
nmaves
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017
10:45 PM
Re: Dynamically update TargetList / TargetGroup
So there seems to be so much wrong with the TargetGroup.
I have tried both ways that you suggested and while the list is updated in both cases the TargetGroup fails to update it's internal focusIndex.
So after I have deleted all of the content nodes and replaced them the focus could still be on item 3 (or any greater than 0).
If I call the below code the UI updates to show the first item of the list is now focused but if you try to use the arrows left and right the UI updates as if the old focusIndex was still set.
I have tried both ways that you suggested and while the list is updated in both cases the TargetGroup fails to update it's internal focusIndex.
So after I have deleted all of the content nodes and replaced them the focus could still be on item 3 (or any greater than 0).
If I call the below code the UI updates to show the first item of the list is now focused but if you try to use the arrows left and right the UI updates as if the old focusIndex was still set.
m.titlesList.animateToItem = 0
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017
07:53 AM
Re: Dynamically update TargetList / TargetGroup
Not sure whether there's a way to override that, I haven't worked much with the "Target" components.
As far as the screen flashing I believe there was a workaround to fade out the container and fade it back in after the child component replacement. Don't hold me to it 🙂
As far as the screen flashing I believe there was a workaround to fade out the container and fade it back in after the child component replacement. Don't hold me to it 🙂
aspiring
owen777
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018
03:05 AM
Re: Dynamically update TargetList / TargetGroup
Will someone from Roku do something about these bugs? Will we see at least an official comment?