B4J Question [ABMaterial] TimeoutException

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

I copy some code showing abmtable(as following picture) from demo project. the ide always has a exception as following code when abmtable is showing some seconds later. Why ..!? Do I have missing anything !? :confused::mad:o_O:eek:

B4X:
Sub Page_Ready()              
    ConnectPage   
End Sub

Sub ConnectPage()
    'NEW
    ABMShared.ConnectNavigationBar(page)
   
    FirstNames.Initialize2(Array As String("Alain", "Jos", "Paul", "Bertrande", "Julie", "Stephanie", "Bert", "Charles", "James", "Walter"))
    LastNames.Initialize2(Array As String("Bailleul", "Rogiers", "Dougherty", "Rodrigues", "Ostrander", "Kenyon", "Grant", "Klinger", "Sheffield", "Poindexter"))
   
    ' add paragraph   
    page.Cell(1,1).AddComponent(ABMShared.BuildParagraphBQ(page,"par1b", "The Id of a table {B}MAY NOT CONTAIN A _ CHARACTER!{/B}.  This is because of the inner working of nested table and the _ character is reserved.") )
   
    ' create a table
    Dim tbl1 As ABMTable
    tbl1.Initialize(page, "tbl1", False, False, True, "tbl1theme")
    tbl1.SetHeaders(Array As String("First Name", "Last Name", "Sales Profit"))
    tbl1.SetColumnDataFields(Array As String("FirstName", "LastName", "SalesProfit"))
    tbl1.SetHeaderThemes(Array As String("headerfooter", "headerfooter", "headerfooterright"))
   
    ' add some random values
    For i = 0 To 9
        Dim r As List
        Dim rCellThemes As List
        r.Initialize
        rCellThemes.Initialize
        r.Add(FirstNames.get(Rnd(0,9)))
        rCellThemes.Add("nocolor") ' nocoloredit
        r.Add(LastNames.get(Rnd(0,9)))
        rCellThemes.Add("nocolor")       
        Dim Neg As Int = Rnd(0,100)
        If Neg > 50 Then
            r.Add("$" & Rnd(1000, 15000))
            rCellThemes.Add("positive")
        Else
            r.Add("$-" & Rnd(1000, 15000))
            rCellThemes.Add("negative")
        End If
        tbl1.AddRow("uid" & i, r)
        tbl1.SetRowThemes(rCellThemes) ' make sure you have as many items in rCellThemes as in r!
    Next
   
    tbl1.SetFooter("This is a footer that appears on the bottom of the table.", 12,"headerfooter")
   
    page.Cell(2,1).AddComponent(tbl1)
   
    page.Refresh ' IMPORTANT
   
    ' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL
    page.FinishedLoading 'IMPORTANT   
   
    page.RestoreNavigationBarPosition
End Sub

B4X:
WebSocket Disconnected
WebSocket Connected
Waiting for value (100 ms)
Waiting for value (100 ms)
java.util.concurrent.TimeoutException
    at anywheresoftware.b4j.object.WebSocket$SimpleFuture.getValue(WebSocket.java:63)
    at com.ab.abmaterial.ABMTable.GetActiveTableRow(Unknown Source)
    at com.ab.abmaterial.ABMTable.GetActiveRow(Unknown Source)
    at com.ab.abmaterial.ABMTable.RefreshInternal(Unknown Source)
    at com.ab.abmaterial.ABMTable.FirstRunInternal(Unknown Source)
    at com.ab.abmaterial.ABMCell.RefreshInternalExtra(Unknown Source)
    at com.ab.abmaterial.ABMRow.RefreshInternal(Unknown Source)
    at com.ab.abmaterial.ABMPage.Refresh(Unknown Source)
    at b4j.example.signalpage._connectpage(signalpage.java:512)
    at b4j.example.signalpage._page_ready(signalpage.java:662)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:612)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:462)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:409)
    at b4j.example.signalpage._page_parseevent(signalpage.java:617)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:612)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at anywheresoftware.b4j.object.WebSocketModule$Adapter$1.run(WebSocketModule.java:126)
    at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
    at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
    at anywheresoftware.b4a.ShellBA.startMessageLoop(ShellBA.java:111)
    at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:131)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:301)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.main(main.java:29)

46c0ca6517cb5d68996818def23afb3a.png
 

jinyistudio

Well-Known Member
Licensed User
Longtime User
1. 2.20
2. my browser is firefox
3. demo project is OK ! :eek:
4. full code as following:
B4X:
#Region Notes
' Server WebSocket Class Module: LEDSwitchPage
' Purpose:
' Manage browser connection and switching of LED
#End Region

'
Sub Class_Globals
    Private ws As WebSocket 'ignore
    ' will hold our page information
    Public page As ABMPage
    ' page theme
    Private theme As ABMTheme
    ' to access the constants
    Private ABM As ABMaterial 'ignore   
    ' name of the page, must be the same as the class name (case sensitive!)
    Public Name As String = "SignalPage"
    ' name of the app, same as in ABMApplication
    Public AppName As String = "dnc-node"
    ' will hold the unique browsers window id
    Private ABMPageId As String = ""
   
    ' own project vars
    Dim LogTimer As Timer   
    Dim FirstNames As List
    Dim LastNames As List
    Dim tbl1Counter As Int = 1
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
    ' build the local structure IMPORTANT!
    BuildPage
End Sub

Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
    Log("WebSocket Connected")
    ws = WebSocket1   
    ABMPageId = ABM.GetPageID(page, Name,ws)
    ' 讀取網頁參數   
    'Dim s1 As String=ws.UpgradeRequest.FullRequestURI
    'Dim n1 As Int=ws.UpgradeRequest.FullRequestURI.IndexOf("EqipPage?")
    'If n1>0 Then
    '    Dim sp() As String=Regex.Split(",",s1.SubString(n1+9))
    '    If sp.Length>=3 Then
    '        sideReturn = sp(1)
    '        subsideReturn = sp(2)
    '        ABMShared.BuildNavigationBar(page, "單機稼動及數據","../images/logo.png","",sideReturn,subsideReturn)
    '    End If
    'End If
   
    If ABMShared.NeedsAuthorization Then
        If ws.Session.GetAttribute2("IsAuthorized", "") = "" Then
            ABMShared.NavigateToPage(ws,ABMPageId, "../")
            Return
        End If
    End If
   
    ' connect our page with the websocket   
    page.SetWebSocket(ws)   
    ' Prepare the page IMPORTANT!
    page.Prepare   
    'ConnectPage
   
    LogTimer.Initialize("LogTimer", 3000)
    LogTimer.Enabled = True
End Sub

Private Sub WebSocket_Disconnected
    Log("WebSocket Disconnected")
    LogTimer.Enabled = False
End Sub

Sub Page_ParseEvent(Params As Map)
    Dim eventName As String = Params.Get("eventname")
    Dim eventParams() As String = Regex.Split(",",Params.Get("eventparams"))
    If SubExists(Me, eventName) Then
        Params.Remove("eventname")
        Params.Remove("eventparams")
        Select Case Params.Size
            Case 0
                CallSub(Me, eventName)
            Case 1
                CallSub2(Me, eventName, Params.Get(eventParams(0)))                   
            Case 2
                If Params.get(eventParams(0)) = "abmistable" Then
                    Dim PassedTables As List = ABM.ProcessTablesFromTargetName(Params.get(eventParams(1)))
                    CallSub2(Me, eventName, PassedTables)
                Else
                    CallSub3(Me, eventName, Params.Get(eventParams(0)), Params.Get(eventParams(1)))
                End If
            Case Else
                ' cannot be called diretly, to many param
                CallSub2(Me, eventName, Params)               
        End Select
    End If
End Sub

public Sub BuildTheme()
    ' start with the base theme defined in ABMShared
    theme.Initialize("pagetheme")
    theme.AddABMTheme(ABMShared.MyTheme)
   
    ' add additional themes specific for this page
    theme.AddTableTheme("tbl1theme")
    theme.Table("tbl1theme").ZDepth = ABM.ZDEPTH_1
   
    theme.Table("tbl1theme").AddCellTheme("headerfooter")
    theme.Table("tbl1theme").Cell("headerfooter").BackColor = ABM.COLOR_BLUEGREY
    theme.Table("tbl1theme").Cell("headerfooter").ForeColor = ABM.COLOR_WHITE   
   
    theme.Table("tbl1theme").AddCellTheme("headerfooterright")
    theme.Table("tbl1theme").Cell("headerfooterright").BackColor = ABM.COLOR_BLUEGREY
    theme.Table("tbl1theme").Cell("headerfooterright").ForeColor = ABM.COLOR_WHITE
    theme.Table("tbl1theme").Cell("headerfooterright").Align = ABM.TABLECELL_HORIZONTALALIGN_RIGHT
   
    theme.Table("tbl1theme").AddCellTheme("nocolor")
    theme.Table("tbl1theme").Cell("nocolor").ActiveBackColor = ABM.COLOR_BLUEGREY
    theme.Table("tbl1theme").Cell("nocolor").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN2
   
    theme.Table("tbl1theme").AddCellTheme("nocoloredit")
    theme.Table("tbl1theme").Cell("nocoloredit").ActiveBackColor = ABM.COLOR_BLUEGREY
    theme.Table("tbl1theme").Cell("nocoloredit").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN2
    theme.Table("tbl1theme").Cell("nocoloredit").IsEditable = True
    theme.Table("tbl1theme").Cell("nocoloredit").InputMask = "'alias':'decimal', 'digits': 2"
    theme.Table("tbl1theme").Cell("nocoloredit").AllowEnterKey = False
   
    theme.Table("tbl1theme").AddCellTheme("positive")
    theme.Table("tbl1theme").Cell("positive").BackColor = ABM.COLOR_GREEN
    theme.Table("tbl1theme").Cell("positive").BackColorIntensity = ABM.INTENSITY_LIGHTEN3
    theme.Table("tbl1theme").Cell("positive").ActiveBackColor = ABM.COLOR_GREEN
    theme.Table("tbl1theme").Cell("positive").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN1
    theme.Table("tbl1theme").Cell("positive").Align = ABM.TABLECELL_HORIZONTALALIGN_RIGHT
   
    theme.Table("tbl1theme").AddCellTheme("negative")
    theme.Table("tbl1theme").Cell("negative").BackColor = ABM.COLOR_RED
    theme.Table("tbl1theme").Cell("negative").BackColorIntensity = ABM.INTENSITY_LIGHTEN3
    theme.Table("tbl1theme").Cell("negative").ActiveBackColor = ABM.COLOR_RED
    theme.Table("tbl1theme").Cell("negative").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN1
    theme.Table("tbl1theme").Cell("negative").Align = ABM.TABLECELL_HORIZONTALALIGN_RIGHT
   
    theme.Table("tbl1theme").AddCellTheme("aligntop")
    theme.Table("tbl1theme").Cell("aligntop").VerticalAlign = ABM.TABLECELL_VERTICALALIGN_TOP
   
    ' add additional themes specific for this page
End Sub

public Sub BuildPage()
    ' initialize the theme
    Dim s1 As String=page.Handler
    BuildTheme       
   
    ' initialize this page using our theme
    page.InitializeWithTheme(Name, "/ws/" & AppName & "/" & Name, False,3, theme)
    page.ShowLoader=True
    page.PageHTMLName = "index.html"
    page.PageTitle = "DNC-Node"
    page.PageDescription = "顯示所有設定信號的即時狀態."
    page.PageKeywords = "IoT, B4J"
    page.PageSiteMapPriority = ""
    page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_YEARLY
    page.ShowConnectedIndicator = True
    ABMShared.BuildNavigationBar(page, "信號即時狀態","../images/logo.png","","signal","signal")   
    ' adding a navigation bar
    ' create the page grid
    page.AddRows(1,True, "").AddCells12(1,"")
    page.AddRows(1, True,"").AddCellsOS(1,0,0,0,5,5,5,"").AddCellsOS(1,1,1,1,1,1,1,"").AddCellsOS(1,0,0,0,5,5,5,"")
    page.BuildGrid 'IMPORTANT loaded the complete grid prior adding components   
    '
    ' Fixed Footer
    ABMShared.BuildFooterFixed(page)
End Sub

Sub BuildItem(id As String, text As String, messages As String, isnew As Boolean) As ABMContainer
   Dim ItemCont As ABMContainer
    ItemCont.Initialize(page, id, "")
   ItemCont.AddRowsM(1,False,0,0,"").AddCellsOSMP(1,0,0,0,4,4,4,6,0,0,0,"").AddCellsOSMP(1,0,0,0,8,8,8,6,0,0,0,"")
   ItemCont.BuildGrid ' IMPORTANT once you loaded the complete grid And before you start adding components

   Dim lbl As ABMLabel
   lbl.Initialize(page, id & "lbl", text, ABM.SIZE_PARAGRAPH, False, "")
   lbl.Text=text
   ItemCont.Cell(1,1).AddComponent(lbl)
  
   Dim lbl1 As ABMLabel
   lbl1.Initialize(page, id & "val", text, ABM.SIZE_H5, False, "")
   lbl1.Text = messages
   ItemCont.Cell(1,2).AddComponent(lbl1)
  
   Return ItemCont
End Sub

Sub UpdateEquipValue
   

End Sub

' clicked on the navigation bar
Sub Page_NavigationbarClicked(Action As String, Value As String)   
    page.SaveNavigationBarPosition
    If Action = "ABMModalSheet" Then Return
    If Action = "Contact" Then   
        page.ShowToast("toast", "toastred", "Hello to you too!", 5000)
        Return
    End If
    If Action = "Logoff" Then
        ABMShared.LogOff(page)
        Return
    End If
    ABMShared.NavigateToPage(ws, ABMPageId, Value)
End Sub
' When the download is finished, you'll receive an FileUploaded() event on the page.
Sub Page_FileUploaded(FileName As String, success As Boolean)   
   
End Sub

Sub Page_ToastClicked(ToastId As String, Action As String)
       
End Sub

Sub Page_ToastDismissed(ToastId As String)   
   
End Sub

Sub Page_Ready()              
    ConnectPage   
End Sub

Sub ConnectPage()
    'NEW
    ABMShared.ConnectNavigationBar(page)
   
    FirstNames.Initialize2(Array As String("Alain", "Jos", "Paul", "Bertrande", "Julie", "Stephanie", "Bert", "Charles", "James", "Walter"))
    LastNames.Initialize2(Array As String("Bailleul", "Rogiers", "Dougherty", "Rodrigues", "Ostrander", "Kenyon", "Grant", "Klinger", "Sheffield", "Poindexter"))
   
    ' add paragraph   
    page.Cell(1,1).AddComponent(ABMShared.BuildParagraphBQ(page,"par1b", "The Id of a table {B}MAY NOT CONTAIN A _ CHARACTER!{/B}.  This is because of the inner working of nested table and the _ character is reserved.") )
   
    ' create a table
    Dim tbl1 As ABMTable
    tbl1.Initialize(page, "tbl1", False, False, True, "tbl1theme")
    tbl1.SetHeaders(Array As String("Signal Name", "Value"))
    tbl1.SetColumnDataFields(Array As String("Alias/Signal", "Value"))
    tbl1.SetColumnWidths(Array As Int(250,180))
    tbl1.SetHeaderThemes(Array As String("headerfooter", "headerfooterright"))
    ' add some random values
    If db.signals.Size>0 Then
        For i0 = 0 To db.signals.Size-1
            Dim ip As String=db.signals.GetKeyAt(i0)
            Dim mp1 As Map=db.signals.GetValueAt(i0)
            If mp1.Size>0 Then
                For i2=0 To 3
                    If mp1.ContainsKey("DI"&i2) Then
                        Dim mp2 As Map=mp1.Get("DI"&i2)
                        Dim s1 As String=mp2.Getdefault("pin","")
                        Dim s2 As String=mp2.Getdefault("alias","")
                        Dim r As List
                        Dim rCellThemes As List
                        r.Initialize
                        rCellThemes.Initialize
                        r.Add(s2)
                        rCellThemes.Add("nocolor") ' nocoloredit       
                        '
                        r.Add("false")
                        rCellThemes.Add("negative") ' nocoloredit
                        '
                        tbl1.AddRow(s2, r)
                        tbl1.SetRowThemes(rCellThemes) ' make sure you have as many items in rCellThemes as in r!
                    End If
                Next
            End If
        Next   
    End If
    tbl1.SetFooter("位元型信號.", 12,"headerfooter")   
    ' create a table2
    Dim tbl2 As ABMTable
    tbl2.Initialize(page, "tbl2", False, False, True, "tbl1theme")
    tbl2.SetHeaders(Array As String("Alias/Name", "Value"))
    tbl2.SetColumnDataFields(Array As String("Alias/Name", "Value"))
    tbl2.SetColumnWidths(Array As Int(250,180))
    tbl2.SetHeaderThemes(Array As String("headerfooter", "headerfooterright"))
    ' add some random values
    If db.signals.Size>0 Then
        For i0 = 0 To db.signals.Size-1
            Dim ip As String=db.signals.GetKeyAt(i0)
            Dim mp1 As Map=db.signals.GetValueAt(i0)
            If mp1.Size>0 Then
                For i2=0 To 3
                    If mp1.ContainsKey("AI"&i2) Then
                        Dim mp2 As Map=mp1.Get("AI"&i2)
                        Dim s1 As String=mp2.Getdefault("pin","")
                        Dim s2 As String=mp2.Getdefault("alias","")
                        Dim r As List
                        Dim rCellThemes As List
                        r.Initialize
                        rCellThemes.Initialize
                        r.Add(s2)
                        rCellThemes.Add("nocolor") ' nocoloredit       
                        '
                        r.Add("0")
                        rCellThemes.Add("positiive") ' nocoloredit
                        '
                        tbl2.AddRow(s2, r)
                        tbl2.SetRowThemes(rCellThemes) ' make sure you have as many items in rCellThemes as in r!
                    End If
                Next
            End If
        Next   
    End If
    tbl2.SetFooter("數字型信號.", 12,"headerfooter")
   
    page.Cell(2,1).AddComponent(tbl1)       
    page.Cell(2,3).AddComponent(tbl2)
   
   
    page.Refresh ' IMPORTANT
   
    ' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL
    page.FinishedLoading 'IMPORTANT   
   
    page.RestoreNavigationBarPosition
End Sub

Sub LogTimer_Tick
   
End Sub

Sub tbl1_Clicked(PassedRowsAndColumns As List)

End Sub
#Region Buttons

#End Region

#Region User Function
Sub BuildSimpleItem0(id As String, icon As String, Title As String) As ABMLabel
    Dim lbl As ABMLabel
    If icon <> "" Then
        lbl.Initialize(page, id, Title, ABM.SIZE_H6, True, "header")
    Else
        lbl.Initialize(page, id, Title, ABM.SIZE_H6, True, "")
    End If
    lbl.VerticalAlign = True
    lbl.IconName = icon
    Return lbl
End Sub

Sub BuildSimpleItem1(id As String, icon As String, Title As String) As ABMLabel
    Dim lbl As ABMLabel
    If icon <> "" Then
        lbl.Initialize(page, id, Title, ABM.SIZE_H6, True, "header")
    Else
        lbl.Initialize(page, id, Title, ABM.SIZE_H6, True, "")
    End If
    lbl.VerticalAlign = True   
    lbl.IconName = icon
    Return lbl
End Sub
#End Region
 
Last edited:
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi
tbl1.Initialize(page, "tbl2", False, False, True, "tbl1theme") ---> NG
tbl1.Initialize(page, "tbl1", False, False, False, "tbl1theme") ---> OK :)
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Can you try using these updated b4j_ws files? I encountered in 3.00 a similar issue with firefox, so I made the same changes in the 2.20 versions.

Take a backup of your old ones!

NOTE: Users with a higher version of ABMaterial 2.20, do NOT use these files!
 

Attachments

  • b4j_ws.zip
    7.7 KB · Views: 296
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

No, I got another question !

c8aef9ab47a143672909e78fcb54671f.png
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi, sorry

I update b4j_ws.zip into my project/js directory. the result is abmtable cann't showing !

9cb7fd9e6123bb231a3a7d40ece4a8c3.png
 
Upvote 0

mindful

Active Member
Licensed User
there is something weird in your code when you build the page:
B4X:
page.InitializeWithTheme(Name, "/ws/" & AppName & "/" & Name, False, 3, theme)
InitializeWithTheme(name, handler, centerInPageWithPadding, SessionsMaxInactiveIntervalSeconds, theme) ... you are settign SessionMaxInactiveintervalSeconds to 3 ... which means that ABMaterial will send a request for donnotdelete.conn every 1.5 seconds. This is the reason why you see so many heartbeat requests!
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi
But I can lauch Page_Ready ! :D
782ab5fcce3129b93722f3fa8a95919a.png
 
Upvote 0

mindful

Active Member
Licensed User
This why nothing is showing ... because ConnectPage isn't called ... in 2.17 AB instructed that we can remove the page_ready sub ... try following the steps in the checklist files to make sure that everything is setup as needed, also you should update to 2.51 or 3.00 if you can ...
 
Upvote 0

amminf

Active Member
Licensed User
Longtime User
Me too error, using new .js files provided for AB.

Using ABM 2.17, showing table with 1200 rows.



upload_2017-3-19_21-16-20.png
 
Upvote 0

amminf

Active Member
Licensed User
Longtime User
A semi-workaround is call to page.showmodalsheet prior to table.refresh first time: its very rapid
Second time only myModal.showmodalsheet, its very slow.

Relevant code:

B4X:
Sb LogOff(page As ABMPage)
   
   
    If Not(lUsrJefeCompras) Then
        LogOffReal(page)
    Else
        If lPriVezSelector Then
            Dim aClientesLugar() As String = Regex.Split(",", mapUsuario.Get("codclilug"))
            Dim aClientesCentral() As String = Regex.Split(",", mapUsuario.Get("codclicen"))
            Dim aClientesLista(aClientesLugar.Length) As String
            Dim i As Int
            Dim c As String
            Dim cCodCli As String
            Dim objCli As Map
           
            Dim aClientesMap As List
           
            aClientesMap.Initialize
       
       
            If False Then
                For i = 0 To aClientesLugar.Length- 1
                    cCodCli = aClientesLugar(i)
                    objCli = Bus2_Client(cCodCli)
                    If IsNullMap(objCli) = False Then
                   
                        c = cCodCli & " " & objCli.Get("nomcli") & " " & objCli.Get("estcli") & " " & objCli.Get("pobcli")    
                        aClientesLista(i) = c
                   
                        aClientesMap.Add(objCli)
                    Else
                        Log("Error !! Cliente no encontrado " & i & " " & cCodCli & " " & objCli)
                    End If
                   
                Next
            Else
                Dim SQL_str As String
                SQL_str =   "SELECT codcli,nomcli,estcli,pobcli,te1cli" _ 
                          & " " _
                          & "FROM "            & cAliClient
                         
                'SQL_str = SQL_str & " WHERE '1' = '1'"
               
                SQL_str = SQL_str & " WHERE FIND_IN_SET(codcli, '"& mapUsuario.Get("codclilug")& "')"
                Dim SQL As SQL = DBM.GetSQL
       
                aClientesMap = DBM.SQLSelect(SQL, SQL_str)
               
                DBM.CloseSQL(SQL)
           
            End If       
            'MostrarSelectorClientes( page, aClientesLugar, aClientesCentral, aClientesLista, aClientesObj)
           
            Dim cId     As String        = "inpSelectorClientes"
            page.ShowModalSheet(cId)
           
            MostrarSelectorClientes( page, aClientesLugar, aClientesCentral, aClientesMap)
            lPriVezSelector = False
        Else
            Dim cId     As String        = "inpSelectorClientes"
            Dim myModal As ABMModalSheet = page.ModalSheet(cId)

            page.ShowModalSheet(cId)
            myModal.Refresh
            'page.Refresh
        End If
    End If
   
   
   
   
End Sub


Sub MostrarSelectorClientes(page As ABMPage,  aClientesLugar As List, aClientesCentral As List, aClientesMap As List)
   
    Dim lTableScrollableBusca As Boolean = True
   
   
    Dim cId     As String        = "inpSelectorClientes"
    Dim myModal     As ABMModalSheet = page.ModalSheet(cId)
    'Dim Content As ABMContainer  = inp.Content
    'Dim pdf     As ABMPDFViewer  = Content.Component("pdf")
   
    'Log("love el pdf " & cFullPdf)
   
    'pdf.SetDocument(cFullPdf)
    ''pdf.Refresh



    pageSeleccion = page
    aClientesLugarGlobal   = aClientesLugar
    aClientesCentralGlobal = aClientesCentral


    Dim oCon As ABMContainer = myModal.Content ' Aqui ERROR si se entra directamente (soyyo)
    'Dim myModal As ABMModalSheet = inp   






    Dim tblCases As ABMTable = oCon.Component("tblSelectorClientes")    'RetSheetBusca.Content.Component("tblBusca")  ' page.Component("tblBusca")   
    Dim MaxRows As Int = 20              ' AMM Al 26/10/16
    Dim nMaxRows As Int = MaxRows - 2




    tblCases.SetColumnVisible(Array As Boolean(False, True              , True         , True     , True, True, True))
   
   



   
    Dim FromPage = 1 As Int ' AMM Al 26/10/16
   
    Dim cases As List = aClientesMap
   
   
    If cases.Size = 0 And FromPage > 1 Then
        ' we are on a page without any lines (maybe removed by other user?)

        FromPage = FromPage - 1
       
        Log("faltaria esto para el caso de paginacion !!!!!!!")
        'Busca_LoadTable(FromPage)
   
        Return
    End If
   
    
       
    If True Then 'lPriVezSelector Then
        Dim cCodCli As String
       
    
        tblCases.Clear
       
        Dim myToastId As Int = 1
        Dim cNameToast = "toast_carga "& myToastId
        page.ShowToast(cNameToast, "toastred", "Espere un momento...", 500 ) '120000)

        Dim tblFields As Map '= cases.Get(i)
        Dim rCellValues As List
        Dim rCellThemes As List
        Dim lPriVez  As Boolean = True
       
        For i = 0 To cases.Size - 1
           
            tblFields= cases.Get(i)
           
            rCellValues.Initialize
           
                            rCellThemes.Initialize
                       
           
           
           
           

           
              
                          
               cCodCli = tblFields.Get("codcli")
              
              
               rCellValues.Add( cCodCli )   ' Id
                                rCellThemes.Add("nocolor")
                          
              
              
               rCellValues.Add(cCodCli )   ' Id de la cabecera del documento, es tambien el numero de pedido.
                               rCellThemes.Add("nocolor")
               
               rCellValues.Add(tblFields.Get("nomcli") ) 
                                  rCellThemes.Add("nocolor")
                             
               rCellValues.Add(tblFields.Get("estcli") ) 
                                  rCellThemes.Add("nocolor")

               rCellValues.Add(tblFields.Get("pobcli") ) 
               rCellThemes.Add("nocolor")


               rCellValues.Add(tblFields.Get("te1cli") ) 
                                  rCellThemes.Add("nocolor")
                             
                   Dim btnSeleccionCliente As ABMButton
                   btnSeleccionCliente.InitializeFloating(page, "btnSeleccionCliente", "mdi-action-assignment-return", "")
                                
                rCellValues.Add(btnSeleccionCliente)
               
                   rCellThemes.Add("openedit")   
                                

     

            tblCases.AddRow("uid" & i, rCellValues)
            tblCases.SetRowThemes(rCellThemes) ' make sure you have as many items in rCellThemes as in rCellValues!  Must follow IMMEDIATELY AFTER AddRow!
       
        Next
       
        page.DismissToast(cNameToast)
             
       
       
        tblCases.Refresh
    End If
   
 
   

End Sub
 
Upvote 0

amminf

Active Member
Licensed User
Longtime User
Using ABM 3.00, too timeout exception.

With 1200 rows on table: error
With 200 rows on table: no error
 
Upvote 0

amminf

Active Member
Licensed User
Longtime User
AB thks, but

is it possible to recycle rcelltheme list so ? I tried and that failed.

B4X:
Dim rCellValues As List
Dim rCellThemes As List

Dim bSwitch As Boolean = True

For i = 0 To cases.Size - 1
   tblFields= cases.Get(i)
   rCellValues.Initialize
   rCellThemes.Initialize

   rCellValues.Add(tblFields.Get("codcli"))
   if  bSwitch then
       rCellThemes.Add("nocolor")
   end if

   rCellValues.Add(tblFields.Get("nomcli"))
   if  bSwitch then
       rCellThemes.Add("nocolor")
   end if


   tblCases.AddRow("uid" & i, rCellValues)
   tblCases.SetRowThemes(rCellThemes)

   bSwitch = false
next

tblCases.Refresh
 
Upvote 0
Top