简体   繁体   中英

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.

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 

''''''''`

Can You try with something like this:

rowAA = {}
rowAA.title = UCase(fieldInJsonAA)
rowAA.children = itemsNodeArray

Or

rowAA = {}
rowAA["title"] = UCase(fieldInJsonAA)
rowAA["children"] = itemsNodeArray

EDIT: I initially understood that script doesn't compile.

What I notice is that in Your ParseMediaItemNode method You are passing fieldInJsonAA without upperCase and then after it in rowAA You are passing the same fieldInJsonAA but but with upper case. Try to pass it in upper case in ParseMediaItemNode as well and check what happens. That's a wild guess since I don't know much about script You are using.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM