Search code examples
rokubrightscriptscenegraph

How to convert Roku Scenegraph GridView to lower case


I'm working on a scenegraph GridView app. All of the row items are all lowercase.

I would like to convert them to Upper case.

I am using Roku Scenegraph Developer Extensions. (SGDex)

I have tried using UCase on the RowAA. This does change the title to Upper Case, but it breaks the script.

ie...

title: UCase(fieldInJsonAA)

    if fieldInJsonAA = "movies" or fieldInJsonAA = "series"

        mediaItemsArray = jsonAA[fieldInJsonAA]
        itemsNodeArray = []
        for each mediaItem in mediaItemsArray
            itemNode = ParseMediaItemToNode(mediaItem, fieldInJsonAA)
            itemsNodeArray.Push(itemNode)
        end for
        rowAA = {
           'title: fieldInJsonAA
           title: UCase(fieldInJsonAA)
           children: itemsNodeArray
        }

The method I tried the in Example does Change the row title to Upper Case. However, it breaks the script.


Solution

  • I figured it out. By default, the DetailsView expects the row title to be lower case, so it was omitting the 'play' or the 'episode' button when I changed it.

    By changing the Details view as follows, this allows the script to run with upper or lower case.

    Details View...

    `''' Default Code''' 
    
    if currentItem.url <> invalid and currentItem.url <> "" 
        buttonsToCreate.Push({ title: "Play", id: "play" }) 
    else if details.content.TITLE = "series" 
        buttonsToCreate.Push({ title: "Episodes", id: "episodes" }) 
    end if 
    
    ''''''''
    
    ''' Updated Code that works with lower or upper case''' 
    
    if currentItem.url <> invalid and currentItem.url <> "" 
        buttonsToCreate.Push({ title: "Play", id: "play" }) 
    else if details.content.TITLE = "series" 
        buttonsToCreate.Push({ title: "Episodes", id: "episodes" }) 
    else if details.content.TITLE = "SERIES" 
        buttonsToCreate.Push({ title: "Episodes", id: "episodes" }) 
    end if 
    
    ''''''''`