Private Sub tblemployees_HeaderClick (HeaderName As String, Status As Boolean)
    'a column header has been clicked
    Select Case HeaderName
    Case "id","employeeid", "name","picture","uploadpicture","phone","email","address","city","state","zip","notes"
        'store the order on localstorage
        Dim sb As Map = CreateMap()
        sb.Put(HeaderName, Status)
        Dim sbs As String = banano.ToJson(sb)
        banano.SetLocalStorage2("employees_order", sbs)
        'Mount the records
        banano.Await(mounted)
    Case Else
        banano.SetLocalStorage2("employees_order", "")
        'Mount the records
        banano.Await(mounted)
    End Select
End Sub'select all Employees
    dbemployees.CLEAR_WHERE
    '
    Dim sbs As String = banano.GetLocalStorage2("employees_order")
    sbs = SDUIShared.CStr(sbs)
    If sbs = "" Then
        dbemployees.ADD_ORDER_BY("name")
    Else
        Dim sb As Map = banano.FromJson(sbs)
        Dim fn As String = sb.GetKeyAt(0)
        Dim so As Boolean = SDUIShared.CBool(sb.GetValueAt(0))
        Select Case so
        Case True
            'asc
            dbemployees.ADD_ORDER_BY(fn)
        Case False
            'desc
            dbemployees.ADD_ORDER_BY_DESC(fn)
        End Select
    End If
    '
    banano.Await(dbemployees.SELECT_ALL)banano.LoadLayout(app.PageViewer, "employeeschedulelayout")
    'set the title of the table listing
    tblemployeeschedule.Title = "Employee Training Schedule"
    'tblemployeeschedule.AddColumn("employeeid", "Employee ID")
    tblemployeeschedule.AddColumn("name", "Full Name")
    tblemployeeschedule.AddColumn("d01", "1")
    tblemployeeschedule.AddColumn("d02", "2")
    tblemployeeschedule.AddColumn("d03", "3")
    tblemployeeschedule.AddColumn("d04", "4")
    tblemployeeschedule.AddColumn("d05", "5")
    tblemployeeschedule.AddColumn("d06", "6")
    tblemployeeschedule.AddColumn("d07", "7")
    tblemployeeschedule.AddColumn("d08", "8")
    tblemployeeschedule.AddColumn("d09", "9")
    tblemployeeschedule.AddColumn("d10", "10")
    tblemployeeschedule.AddColumn("d11", "11")
    tblemployeeschedule.AddColumn("d12", "12")
    tblemployeeschedule.AddColumn("d13", "13")
    tblemployeeschedule.AddColumn("d14", "14")
    tblemployeeschedule.AddColumn("d15", "15")
    tblemployeeschedule.AddColumn("d16", "16")
    tblemployeeschedule.AddColumn("d17", "17")
    tblemployeeschedule.AddColumn("d18", "18")
    tblemployeeschedule.AddColumn("d19", "19")
    tblemployeeschedule.AddColumn("d20", "20")
    tblemployeeschedule.AddColumn("d21", "21")
    tblemployeeschedule.AddColumn("d22", "22")
    tblemployeeschedule.AddColumn("d23", "23")
    tblemployeeschedule.AddColumn("d24", "24")
    tblemployeeschedule.AddColumn("d25", "25")
    tblemployeeschedule.AddColumn("d26", "26")
    tblemployeeschedule.AddColumn("d27", "27")
    tblemployeeschedule.AddColumn("d28", "28")
    tblemployeeschedule.AddColumn("d29", "29")
    tblemployeeschedule.AddColumn("d30", "30")
    tblemployeeschedule.AddColumn("d31", "31")
    '
    tblemployeeschedule.RemoveSearch
    tblemployeeschedule.RemoveColumnChooser
    tblemployeeschedule.RemoveFooterPagination
    '
    tblemployeeschedule.AddHeaderClass("name", "w-[200px] max-w-[200px] min-w-[200px]")
    Dim ist As Int = 0
    For ist = 1 To 31
        Dim xcol As String = SDUIShared.PadRight(ist, 2, "0")
        tblemployeeschedule.AddHeaderClass($"d${xcol}"$, "w-[40px] max-w-[40px] min-w-[40px]")
    Nextbanano.Await(tb4.LoadJSON("./assets/employees.json"))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"))Sub ApplyZebraRows
    'we have 10 items per page
    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 Subbanano.Await(tb4.LoadJSON("./assets/employees.json"))
    'apply background colors
    ApplyZebraRowsPrivate Sub tb11_PrevPage (e As BANanoEvent)
    e.PreventDefault
    ApplyZebraRows
End SubPrivate Sub tb11_NextPage (e As BANanoEvent)
    e.PreventDefault
    ApplyZebraRows
End Sub''set the top, right, bottom and left padding of each cell in the table
    tb12.SetCellPadding("0px", "", "0px", "")'Static code module
#IgnoreWarnings:12
Sub Process_Globals
    'this is the name of the page
    Public name As String = "tables11"
    Public title As String = "Table Functionality"
    Public icon As String = "fa-solid fa-swatchbook"
    'this variable holds the page controller
    Public page As SDUIPage
    'this variable holds reference to the app
    'usually for constants and other things
    Public app As SDUIApp
    'the variable referencing banano lib
    Private banano As BANano        'ignore
    Private tb4 As SDUITable
    Private tblPos As Int
    Private tb12 As SDUITable
    Private srowcount As String
    private summary As Map
End Sub
'sub to show the page
Sub Show(duiapp As SDUIApp)            'ignore
    'initialize the page
    'this clears the 'pageview'
    page.AddPage(Me, name)
    page.Root.p(6)
    'get the reference to the app
    app = duiapp
    app.PagePause
    banano.Await(app.UsesFormToJSON)
    banano.Await(app.UsesTable)
    'build the page, via code or loadlayouts
    '
    
    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
'start building the page
private Sub BuildPage
    'set the page container to be in design mode
    'this shows the row/column grid lines
    page.Root.DesignMode(False)
    'center the page container
    page.Root.MXAuto
    'add 5 rows, each having 2 columns, each spanning 6
    page.Root.AddRows10.AddColumns12
    'build the grid
    page.Root.BuildGrid
    'start adding you components here
    Build_Table5
    Table5Code
End Sub
Sub Table5Code
'    Dim c5 As SDUIMockupCode = page.Cell(2, 1).AddMockUpCode("c5", "vb")
'    c5.AddCode($"Sub Build_Table5"$)
'    c5.AddCode($"tb4 = page.Cell(1, 1).AddTableListView("tb4")"$)
'    c5.AddCode($"tb4.AddColumnAvatarTitleSubTitle("avatar", "Employee", "4rem", "name", "country", app.MASK_HEXAGON)"$)
'    c5.AddCode($"tb4.AddColumnToggle("on", "On/Off", "success", False)"$)
'    c5.AddCode($"'"$)
'    c5.AddCode($"banano.Await(tb4.SetItems(Items))  'or SetItemsPaginate"$)
'    c5.AddCode($"End Sub"$)
'    c5.AddCode($"'"$)
'    c5.AddCode($"Private Sub tb4_ChangeRow (Row As Int, Value As Object, Column As String, item As Map)"$)
'    c5.AddCode($"Log(Row)"$)
'    c5.AddCode($"Log(Value)"$)
'    c5.AddCode($"Log(Column)"$)
'    c5.AddCode($"Log(item)"$)
'    c5.AddCode($"End Sub"$)
'    c5.AddCode($"'"$)
'    c5.AddCode($"Private Sub tb4_RowClick (Row As Int, item As Map)"$)
'    c5.AddCode($"Dim sid As String = item.Get("id")"$)
'    c5.AddCode($"app.ShowSwal(sid)"$)
'    c5.AddCode($"End Sub"$)
'    c5.Refresh
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"))
    'apply background colors
    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
    'show borders around cells
    tb12.GridLines = True
    'set the header background color
    tb12.SetHeaderBackgroundColor("#E9544E")
    'set the header text color
    tb12.SetHeaderTextColor("#ffffff")
    'set the footer background color
    tb12.SetFooterBackgroundColor("#651F3F")
    'set the color of the footer
    tb12.SetFooterTextColor("#ffffff")
    '
    banano.Await(tb12.LoadJSON("./assets/employees.json"))
    'tb12.BodyFontFamily = "Verdana, Geneva, Tahoma, sans-serif"
    tb12.HeaderFontSize = "12px"
    tb12.BodyFontSize = "10px"
    tb12.FooterFontSize = "12px"
    'merge the footer columns to the first column
    tb12.SetFooterColumnsMerge(Array("first_name","last_name","email","phone","gender","age","job_title"))
    'add totals to table
    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")))
    'change the font-size of the first row
    tb12.SetRowStyle(0, CreateMap("font-size": "14px"))
    tb12.SetRowStyle(1, CreateMap("font-style": "italic"))
    tb12.SetRowStyle(2, CreateMap("font-weight": "bold"))
    
    'right align columns
    tb12.SetColumnAlign("years_of_experience", "r")
    tb12.SetColumnAlign("salary", "r")
    tb12.SetColumnAlign("gender", "c")
    'decrease cell padding
    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
    'we have 10 items per page
    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 SubWe use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?