B4J Tutorial [BANanoWebix] Lesson 10 Lists

Mashiane

Expert
Licensed User
Ola

Lesson10_List.gif


Here we demonstrate how we can have a list with a pager linked to it and we animate the list.

First we create a pager element and give it a unique id with the size to show being 10 records. We add this to our page..

B4X:
Private pgr As WixPager
    pgr.Initialize("moviepager").SetAnimate(True).SetSize(10)
    R2.AddColumnsItem(pgr.Item)
We use the dummy data generator we saw in UOENow to generate about 50 records and add these to the list.

B4X:
'lets create dummy data
    Dim dummy As UOENowData
    dummy.Initialize
    Dim structure As Map = CreateMap()
    structure.Put("id", "id")
    structure.Put("rank", "id")
    structure.Put("title", "name")
    structure.Put("year", "year")
    Dim big_film_set As List = dummy.GetRecordsWithStructure(structure, 50)
    '
    Dim fList As WixList
    fList.Initialize("fList").SetWidth(500).SetHeight(360).SetBorderLess(False)
    fList.SetTemplate("#rank#. #title# (#year#)").SetSelect(True)
    fList.SetScroll(False).SetPager("moviepager").SetData(big_film_set)
    '
    R3.AddColumnsItem(fList.item)
We have provided the template for our data to be rank, title and year. We enable selection because we want to trap each select call to the item selected. Then we set the pager to link the pager to the list giving that the pager name.

We add the list to our page.
 
Top