Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
jkoon2
Level 7

Category Leaf Ordering

I'm creating a channel based on the VideoPlayer Sample Channel, is there a way to control the display order of the categoryLeaf elements? The order on screen does not match the order in my feed. 
0 Kudos
6 Replies
genepensiero
Level 7

Re: Category Leaf Ordering

did you ever get an answer to this or figure it out? i'd love to hear. 
0 Kudos
destruk
Level 10

Re: Category Leaf Ordering

You will probably need to specify if it is the old SDK or the new Scenegraph version you're working with.  I think I read somewhere that if it's an associative array then the order will be randomized, so you'd need to sort them first?  But I don't remember exactly.

https://forums.roku.com/viewtopic.php?f ... ve#p556208

If you want them in a different order you should be able to add them individually to a new array before displaying to the screen - rather than using for each you can use a regular for loop -
Something like this -- note - this might not be exactly what you need, just off the top of my head

x=categoryleaf.count()-1
categoryleafcollection=[]
For i=0 to x
categoryleafcollection.push(categoryleaf)
Next
0 Kudos

Re: Category Leaf Ordering

Ditto, same issue... did you ever find a solution for this??! I haven't come up with one yet. Thanks!
0 Kudos

Re: Category Leaf Ordering

This is for the new SDK kit using Scene Graph and the new "Video Player" sample channel. 
I have tried using the .keys() trick to return a keyed associative array, but I haven't figured out how to properly implement that into the UriHandler.brs file. 
I have everything else finished and ready to go so that I can update our channel to run on the new Scene Graph platform, but still have to get this figured out!
I'm sure it is just a couple lines of code, but I can't figure it out. I'm not sure why they didn't put in sample code so those of us who want our category leafs added to the RowList in the same order as our XML files could easily do that! The previous SDK worked this way, but obviously it was very different.

Any help would be greatly appreciated!!
0 Kudos
newchannel
Level 7

Re: Category Leaf Ordering

I'm using the videoplayer channel master to migrate a channel over. I have the same problem...not showing in the same order as the XML. Read forum and have not found a fix. I'm still early in the migrating over stage though. The sample shows the three choices in a row and I'm still trying to figure out how to make changes to it. Migrating might not be as easy as the videoplayer master channel made it seem. A full example with deeplinking would have been helpful instead of a partial example. 
http://www.victoryNOWfilmsandtv.com
0 Kudos
newchannel
Level 7

Re: Category Leaf Ordering

Well, never did find out what is making the order of the items in the XML move around. So, since I only have 3 category leafs anyway, I just moved the order in one of the category leafs to get the result I wanted. Now, on to attempting the deeplinking and change artwork and see if this channel migration will pass the test.
http://www.victoryNOWfilmsandtv.com
0 Kudos