#IgnoreWarnings:12
Sub Process_Globals
Public name As String = "tables11"
Public title As String = "Table Functionality"
Public icon As String = "fa-solid fa-swatchbook"
Public page As SDUIPage
Public app As SDUIApp
Private banano As BANano
Private tb4 As SDUITable
Private tblPos As Int
Private tb12 As SDUITable
Private srowcount As String
private summary As Map
End Sub
Sub Show(duiapp As SDUIApp)
page.AddPage(Me, name)
page.Root.p(6)
app = duiapp
app.PagePause
banano.Await(app.UsesFormToJSON)
banano.Await(app.UsesTable)
BuildPage
app.PageResume
End Sub
Sub getName As String
Return name
End Sub
Sub getIcon As String
Return icon
End Sub
Sub getTitle As String
Return title
End Sub
private Sub BuildPage
page.Root.DesignMode(False)
page.Root.MXAuto
page.Root.AddRows10.AddColumns12
page.Root.BuildGrid
Build_Table5
Table5Code
End Sub
Sub Table5Code
End Sub
Sub Build_Table5
tb4 = page.Cell(1, 1).AddTableCard("tb11")
tb4.Title = "Employees"
tb4.Search = True
tb4.SearchSize = app.SIZE_XS
tb4.ItemsPerPage = 10
tb4.ToolbarActions = True
tb4.ButtonsOutlined = False
tb4.ButtonSize = app.SIZE_XS
tb4.BadgesSize = app.SIZE_XS
tb4.BadgesOutlined = False
tb4.HasAddNew = True
tb4.HasDeleteAll = True
tb4.HasRefresh = True
tb4.AddToolbarActionButtonIcon("active", "fa-solid fa-check", app.COLOR_INDIGO)
tb4.Pagination = True
tb4.Compact
banano.Await(tb4.LoadJSON("./assets/employees.json"))
ApplyZebraRows
tb12 = page.Cell(3, 1).AddTableCard("tb12")
tb12.Title = "Employees"
tb12.Search = True
tb12.SearchSize = app.SIZE_XS
tb12.ItemsPerPage = 10
tb12.ToolbarActions = True
tb12.ButtonsOutlined = False
tb12.ButtonSize = app.SIZE_XS
tb12.BadgesSize = app.SIZE_XS
tb12.BadgesOutlined = False
tb12.HasAddNew = True
tb12.HasDeleteAll = True
tb12.HasRefresh = True
tb12.Pagination = True
tb12.Compact
tb12.GridLines = True
tb12.SetHeaderBackgroundColor("#E9544E")
tb12.SetHeaderTextColor("#ffffff")
tb12.SetFooterBackgroundColor("#651F3F")
tb12.SetFooterTextColor("#ffffff")
banano.Await(tb12.LoadJSON("./assets/employees.json"))
tb12.HeaderFontSize = "12px"
tb12.BodyFontSize = "10px"
tb12.FooterFontSize = "12px"
tb12.SetFooterColumnsMerge(Array("first_name","last_name","email","phone","gender","age","job_title"))
summary = tb12.SetFooterTotalSumCountColumns(Array("years_of_experience", "salary"))
srowcount = summary.Get("rowcount")
srowcount = SDUIShared.Thousands(srowcount)
ApplyTableStyling
End Sub
Sub ApplyTableStyling
tb12.SetFooterColumn("first_name", $"Total (${srowcount})"$)
tb12.SetFooterColumn("salary", SDUIShared.NiceMoney(summary.Get("salary")))
tb12.SetFooterColumn("years_of_experience", SDUIShared.Thousands(summary.Get("years_of_experience")))
tb12.SetRowStyle(0, CreateMap("font-size": "14px"))
tb12.SetRowStyle(1, CreateMap("font-style": "italic"))
tb12.SetRowStyle(2, CreateMap("font-weight": "bold"))
tb12.SetColumnAlign("years_of_experience", "r")
tb12.SetColumnAlign("salary", "r")
tb12.SetColumnAlign("gender", "c")
tb12.SetCellPadding("0px", "", "0px", "")
tb12.SetRowColumnStyle("first_name", 5, CreateMap("font-size": "8px"))
tb12.SetRowColumnStyle("last_name", 6, CreateMap("font-family": "Verdana, Geneva, Tahoma, sans-serif"))
tb12.SetColumnStyle("age", CreateMap("background-color":"green"))
End Sub
Private Sub tb12_PrevPage (e As BANanoEvent)
e.PreventDefault
ApplyTableStyling
End Sub
Private Sub tb12_NextPage (e As BANanoEvent)
e.PreventDefault
ApplyTableStyling
End Sub
Private Sub tb11_RowClick (Row As Int, item As Map)
Dim sid As String = item.Get("id")
app.ShowSwal(sid)
End Sub
Private Sub tb11_PrevPage (e As BANanoEvent)
e.PreventDefault
ApplyZebraRows
End Sub
Private Sub tb11_NextPage (e As BANanoEvent)
e.PreventDefault
ApplyZebraRows
End Sub
Sub ApplyZebraRows
tb4.SetRowBackgroundColor(0, "#E9544E")
tb4.SetRowTextColor(0, "#ffffff")
tb4.SetRowBackgroundColor(1, "#F09D65")
tb4.SetRowBackgroundColor(2, "#FFD364")
tb4.SetRowBackgroundColor(3, "#2AA876")
tb4.SetRowTextColor(3, "#ffffff")
tb4.SetRowBackgroundColor(4, "#E7E7EA")
tb4.SetRowBackgroundColor(5, "#F7ABB7")
tb4.SetRowBackgroundColor(6, "#025B97")
tb4.SetRowTextColor(6, "#ffffff")
tb4.SetRowBackgroundColor(7, "#6496B0")
tb4.SetRowTextColor(7, "#ffffff")
tb4.SetRowBackgroundColor(8, "#651F3F")
tb4.SetRowTextColor(8, "#ffffff")
tb4.SetRowBackgroundColor(9, "#34A69C")
tb4.SetRowTextColor(9, "#ffffff")
End Sub