B4J Question [ABMaterial] SetActivePage does not work

peacemaker

Expert
Licensed User
Longtime User
Hi, All

I have faced the same problem like here: https://www.b4x.com/android/forum/t...ion-working-properly-on-abmtable-footer.76449

B4X:
Sub pagNames_PageChanged(OldPage As Int, NewPage As Int)
    Log("pagNames = " & OldPage & " - " & NewPage)
    Dim total As Long = Refresh_tableNAMES((NewPage - 1) * TABLE_STEP)   
    Dim Current_TotalNumberOfPages As Long = Ceil(total/TABLE_STEP)
    Log("Current_TotalNumberOfPages = " & Current_TotalNumberOfPages)
    If Current_TotalNumberOfPages <> pagNames.GetTotalNumberOfPages Then
        pagNames.SetTotalNumberOfPages(Current_TotalNumberOfPages)
        NewPage = 0
    End If
    pagNames.SetActivePage(NewPage)
    pagNames.Refresh
End Sub

The previous and next buttons of ABMPagination view do not work, OldPage is always = 0.
Any suggestion ?

What does SetActivePage do ?
 
Solution
SOLVED !!!!!!!!!!!!!!

Adding pager to the table footer - is the trouble root. If pager is placed just to a cell - it works OK !

Final question is just ... why pager does not work in a table footer :)

peacemaker

Expert
Licensed User
Longtime User
I have created the test project for testing ABMaterial ideas:
1682348299145.png


Packed without "font", "css", "js" folders in "Objects\www" - get them from the original @alwaysbusy's Mini-template.

Please, use it for experiments, cloning as example for your codes, but ... help me to understand what the problem is with pagination - why OldPage is always = 0 (and previous and next buttons do not work).
 

Attachments

  • TemplateMini_test_pagination.zip
    9.1 KB · Views: 69
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
SOLVED !!!!!!!!!!!!!!

Adding pager to the table footer - is the trouble root. If pager is placed just to a cell - it works OK !

Final question is just ... why pager does not work in a table footer :)
 
Last edited:
Upvote 0
Solution

peacemaker

Expert
Licensed User
Longtime User
More over - ABMpagination component cannot work in an ABMcontainer also :(
 
Last edited:
Upvote 0

FabioRome

Member
Licensed User
Longtime User
More over - ABMpagination component cannot work in an ABMcontainer also :(
B4X:
Sub pag_PageChanged(OldPage As Int, NewPage As Int)
    Dim tabs As ABMTabs = page.Component("tabs")
    Dim pag As ABMPagination = tabs.GetTabPage("name_tabs").Component("pag")
    OldPage = pag.GetActivePage
    
    Dim m As Int
    If NewPage = 1 Then
        m = 0
        posPag = 1
    Else If NewPage = maxPag Then
        m = maxPag * 10
        posPag = maxPag
    Else
        If NewPage > OldPage Then
            posPag = posPag + (NewPage-OldPage)
        Else
            posPag = posPag - (OldPage-NewPage)
        End If
        m = posPag*10
    End If
    
    ...

End Sub
 
Upvote 0
Top