B4J Tutorial [BANanoWebix] Lesson 18 GroupList

Ola

The grouplist enables one to group elements added easily. Thanks to code that @Brandsum for code to unflatten a list of map records to a tree.



We create the grouplist, each record with a 'parentid' property and each record as a map.

B4X:
Dim gl As WixGroupList
    gl.Initialize("gl").SetScroll(True).SetWidth(300).SetBorderLess(False)
    gl.SetStyle("margin","10px")
    '
    'add items
    gl.AddItem("","movies", "Movies","","","","",True)
    gl.AddItem("movies", "startrek", "Star Trek","","","","",False)
    gl.AddItem("movies", "starwars", "Star Wars","","","","",False)
    '
    gl.AddItem("startrek", "tmp", "The Motion Picture","","","","",False)
    gl.AddItem("startrek", "twk", "The Wrath of Khan","","","","",False)
    gl.AddItem("startrek", "sfs", "The Search for Spock","","","","",False)
    '
    gl.AddItem("starwars", "tnh", "A New Hope","","","","",False)
    gl.AddItem("starwars", "tesb", "The Empire Strikes Back","","","","",False)
    gl.AddItem("starwars", "troj", "Return of the Jedi","","","","",False)
    '
    gl.AddItem("","books", "Books","","","","",True)
    gl.AddItem("books","hp", "Harry Potter","","","","",False)
    '
    gl.AddItem("hp","tss", "The Sorcerer's Stone","","","","",False)
    gl.AddItem("hp","tcos", "The Chamber of Secrets","","","","",False)
    gl.AddItem("hp","tpoa", "The Prisoner of Azkaban","","","","",False)
    '
    gl.AddItem("books","dt", "The Dark Tower","","","","",False)
    gl.AddItem("dt","tg", "The Gunslinger","","","","",False)
    gl.AddItem("dt","tdot", "The Drawing of the Three","","","","",False)
    gl.AddItem("dt","twl", "The Waste Lands","","","","",False)
    '
    Dim data As List = pg.Unflatten(gl.items)
    gl.SetData(data)

We then unflatten this structure to be a tree and use .SetData of the grouplist to add the unflattedned data and walla!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…