B4J Question [abmaterial] ABMChronologyList cann't display !?

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi
I call connectpage and the ABMChronologyList is display ok When i open page first.
secondly, when i change a new date and call connectpage again. the ABMChronologyList isn't display. Why .. !?

B4X:
public Sub ConnectPage(now As Long)
    'NEW
    ABMShared.ConnectNavigationBar(page,"")   
   
    ' add paragraph
    Dim chrono As ABMChronologyList
    chrono.Initialize(page, "chrono", "chrono")
    chrono.clear
    Dim lst As List=historydb.kvs.ListKeys(now)
    If lst.Size>0 Then
        For n1=1 To lst.Size
            Dim s1 As String=lst.Get(n1-1)
            Dim mp1 As Map=historydb.kvs.GetObject(s1)
            BuildFiche(chrono,"evt"&n1, s1,mp1)
        Next
        'chrono.Refresh
    End If
    page.Cell(2,1).AddComponent(chrono)
    ' chronolist test
   
    ' also add the components to the footer
    'ABMShared.ConnectFooter(page)
   
    page.Refresh ' IMPORTANT!
       
    ' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL
    page.FinishedLoading 'IMPORTANT
   
    page.RestoreNavigationBarPosition
End Sub

B4X:
Sub BuildFiche(chrono As ABMChronologyList,id As String, eventid As String, data As Map)
    ' 11112233445566
    Dim s1 As String=$"${eventid.SubString2(4,6)}/${eventid.SubString2(6,8)}  ${eventid.SubString2(8,10)}:${eventid.SubString2(10,12)}:${eventid.SubString2(12,14)}"$
    Dim Fiche As ABMContainer
    Dim theme1 As String="green"
    '
    Fiche.Initialize(page, id&"cnt", "")
    Fiche.AddRowsM(1, False,0,0,"green").AddCellsOSMP(1,0,0,0,12,12,12,0,12,10,10,"")
    Fiche.AddRowsM(1, False ,0,0, "").AddCellsOSMP(1,0,0,0,12,12,12,0,0,11,11,"")       
    Fiche.BuildGrid   
    Fiche.Row(1).MarginLeft = "0"
    Fiche.Row(1).MarginRight = "0"
    '
    Dim titLabel As ABMLabel
    titLabel.Initialize(page, id&"lbl1" & id, s1, ABM.SIZE_H5,False, "green")
    Fiche.Cell(1,1).AddComponent(titLabel)
    If data.IsInitialized Then
        Dim s2 As String=data.Get("type")
        Dim titLabel2 As ABMLabel
        titLabel2.Initialize(page, id&"lbl2" & id, s2, ABM.SIZE_H6,False, "white")
        Fiche.Cell(1,1).AddComponent(titLabel2)   
        Fiche.Cell(2,1).AddComponent(BuildCard(id,data))
    End If
   
    chrono.AddSlide(id,Fiche, theme1)
End Sub

B4X:
Sub BuildCard(id As String, data As Map) As ABMTable
    Dim tbl As ABMTable
    tbl.Initialize(page, id&"tbl", True, False, True, "tbl1theme")
   
    'tbl.SetColumnWidths(Array As Int(10,40))   
    If data.Size>0 Then
        For n1=1 To data.Size
            Dim s1 As String=data.GetKeyAt(n1-1)
            If (s1<>"eventid")And(s1<>"type") Then
                Dim row As List
                row.Initialize
                row.Add(data.GetKeyAt(n1-1))
                row.Add(data.GetValueAt(n1-1))
                tbl.AddRow(id&"row"&n1,row)
                tbl.SetRowThemes(Array As String("cellleft","cellleft"))
            End If
        Next
    End If
   
    Return tbl
End Sub

26d5090214cecfea26793aa38c7df10b.png
 

jinyistudio

Well-Known Member
Licensed User
Longtime User
1. i show it ok when i just addslide.
2. when i clear it and then I add some slide's as following code. I cann't show it again. :(

B4X:
Sub mydate3_Changed(Target As String, dateMilliseconds As String)
    Dim BackDate As Long = dateMilliseconds
    '
    Dim chrono As ABMChronologyList=page.Component("chrono")
    chrono.Clear
    Dim lst As List=historydb.kvs.ListKeys(BackDate)
    If lst.Size>0 Then
        For n1=1 To lst.Size
            Dim s1 As String=lst.Get(n1-1)
            Dim mp1 As Map=historydb.kvs.GetObject(s1)
            BuildFiche(chrono,"evt"&n1, s1,mp1)
        Next  
    End If
    chrono.Refresh


    
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.ShowLoaderType=ABM.LOADER_TYPE_MANUAL ' NEW
   page.PageTitle = "dnc-node"
   page.PageDescription = "history table for data collection system"   
   page.PageHTMLName = "index.html"
   page.PageKeywords = "jinyistudio,iot,plc"
   page.PageSiteMapPriority = "0.50"
   page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_MONTHLY   
   'page.UseGoogleAnalytics(ABMShared.TrackingID, Null) ' IMPORTANT Change this to your own TrackingID !!!!!!!
         
   ABMShared.BuildNavigationBar(page, "HISTORY", ABMShared.LogoIcon, "", "History", "History")   
   
   ' create the page grid
   page.AddRowsM(2,True,6,6, "").AddCells12(1,"")
   page.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
   '
   Dim mydate3 As ABMDateTimePicker
   Dim NewDate As Long = DateTime.Now
   mydate3.Initialize(page, "mydate3", ABM.DATETIMEPICKER_TYPE_DATE, NewDate, "Pick a date", "")
   mydate3.CancelText = "Back"
   mydate3.PickText = "OK"
   mydate3.TodayText = "Today"
   mydate3.Language = "en"
   mydate3.ReturnDateFormat = "YYYY/MM/DD"
   mydate3.ClickThrough = True ' <--- set To True If, when the user makes a selection, the ok action should be triggered.
   page.Cell(1,1).AddComponent(mydate3)'   
   Dim chrono As ABMChronologyList
   chrono.Initialize(page, "chrono", "chrono")
   page.Cell(2,1).AddComponent(chrono)
End Sub

public Sub ConnectPage(now As Long)
   'NEW
   ABMShared.ConnectNavigationBar(page,"")   
   
   ' add paragraph
   
   'chrono.clear
   Dim chrono As ABMChronologyList=page.Component("chrono")
   Dim lst As List=historydb.kvs.ListKeys(now)
   If lst.Size>0 Then
     For n1=1 To lst.Size
       Dim s1 As String=lst.Get(n1-1)
       Dim mp1 As Map=historydb.kvs.GetObject(s1)
       BuildFiche(chrono,"evt"&n1, s1,mp1)
     Next
     'chrono.Refresh
   End If
   
   ' chronolist test
   
   ' also add the components to the footer
   'ABMShared.ConnectFooter(page)
   
   page.Refresh ' IMPORTANT!
     
   ' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL
   page.FinishedLoading 'IMPORTANT
   
   page.RestoreNavigationBarPosition
End Sub
End Sub
 
Last edited:
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
when i remove chrono.clear,it could display all data. when i add chrono.clear as following, It coundn't display anything ! Why !? :mad: How could i refresh ABMChronologyList when i add new data !?

B4X:
public Sub ConnectPage(now As Long)
    'NEW
    ABMShared.ConnectNavigationBar(page,"")
    ' add paragraph
    Dim chrono As ABMChronologyList = page.Component("chrono")
    chrono.clear   <<<------------------------- here let me crazy !!
    Dim lst As List=historydb.kvs.ListKeys(now)
    If lst.Size>0 Then
        For n1=1 To lst.Size
            Dim s1 As String=lst.Get(n1-1)
            Dim mp1 As Map=historydb.kvs.GetObject(s1)
            BuildFiche("evt"&n1, s1,mp1)
            chrono.RefreshSlide("evt"&n1)
        Next
        'chrono.Refresh
    End If

    ' also add the components to the footer

    'ABMShared.ConnectFooter(page)

    page.Refresh ' IMPORTANT!

    ' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL
    page.FinishedLoading 'IMPORTANT

    page.RestoreNavigationBarPosition
End Sub
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
thank's ab and fighting
 
Upvote 0
Top