Here is the screenshot where I have some 143 records but cannot get the pagination to work.
Can anybody help me with this problem.
Thanks
Can anybody help me with this problem.
Thanks
B4J ABM Table:
public Sub BuildPage()
' initialize the theme
BuildTheme
' initialize this page using our theme
page.InitializeWithTheme(Name, "/ws/" & ABMShared.AppName & "/" & Name, False, ABMShared.SessionMaxInactiveIntervalSeconds, theme)
page.ShowLoader=True
page.PageHTMLName = "index.html"
page.PageTitle = ""
page.PageDescription = ""
page.PageKeywords = ""
page.PageSiteMapPriority = ""
page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_YEARLY
page.ShowConnectedIndicator = True
' adding a navigation bar
ABMShared.BuildNavigationBar(page, " {B} Wairarapa Storage (2021) Ltd {/B}","../images/logo.png", "", "", "")
' create the page grid
page.AddRowsM(5,True,0,10, "").AddCellsOS(1,0,0,0,12,12,12,"")
page.AddRowsM(5,False,0,5,"").AddCellsOSMP(2,0,0,0,6,6,6,10,10,0,0,"")
page.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
End Sub
public Sub ConnectPage()
' connecting the navigation bar
ABMShared.ConnectNavigationBar(page)
Dim pagination As ABMPagination
pagination.Initialize(page, "pagination",10, True, True, "")
pagination.SetTotalNumberOfPages(10)
page.Cell(1,1).AddComponent(pagination)
Log("added pagination")
page.Cell(1,1).AddComponent(ABMShared.BuildLabel(page,"FirstLine", "Customer: Schubert Wines Stocktake", ABM.SIZE_H4, "lbltheme1", 0, "25px"))
' create a ABMtable to show records
Dim tblTrans As ABMTable
tblTrans.Initialize(page, "tblTrans", True, False, True, "tbltheme")
' set the headers
tblTrans.SetHeaders(Array As String( "Barcode", "Current"))
tblTrans.SetHeaderThemes (Array As String("bg", "bg"))
tblTrans.SetColumnVisible(Array As Boolean(True,True))
tblTrans.IsResponsive = True
tblTrans.IsBordered = True
tblTrans.SetFooter("Total number of Pallets/Bins: 0" , 12, "bg")
' refresh the page
page.cellR(2,1).AddComponent(tblTrans)
' page.Cell(3,1).SetFixedHeight(400, True)
'
' ' Tell the browser we finished loading
page.FinishedLoading
' ' restoring the navigation bar position
page.RestoreNavigationBarPosition
Log("now loading pallets")
'
' create a SQL cursor
Dim SQL As SQL = DBM.GetSQL
'Get the records
Dim numproducts As String
numproducts = DBM.SQLSelectSingleResult(SQL, "Select Count(barcode) FROM products WHERE custindex = 37")
Dim qry As String = "SELECT * FROM products WHERE custindex = 37 ORDER by barcode"
Dim RSlist As List = DBM.SQLSelect(SQL, qry, Null)
Dim i As Int
For i = 0 To RSlist.Size -1
Dim tblFields As Map = RSlist.Get(i)
Dim rCellValues As List
Dim rCellThemes As List
rCellValues.Initialize
rCellThemes.Initialize
rCellValues.Add(tblFields.Get("barcode"))
rCellThemes.Add("nocolor")
rCellValues.Add(tblFields.Get("currentbal"))
rCellThemes.Add("nocolor")
tblTrans.AddRow("uid" &i,rCellValues)
tblTrans.SetRowThemes(rCellThemes)
Next
'page.CellR(3,1).AddComponent(tblTrans)
Log("added tblTrans")
Log("Number of Pallets: "&numproducts)
tblTrans.SetFooter("Total number of Pallets/Bins: " & numproducts, 12, "bgc")
'
tblTrans.Refresh
'
' ' refresh the page
'page.Refresh
DBM.CloseSQL(SQL)
Dim pagination As ABMPagination = page.Component("pagination")
numproducts = numproducts/10
page.Refresh
'
End Sub