The demo for B4JS works. But when I try to use B4JS, I just get a spinning circle and the Browser's console shows:
Steps I performed:
Copy ABMaterial's Template and rename main file.
Add TestPage ABM Web Page class module. In BuildPage, create the following grid
In ConnectPage, add the following code
Add B$JSTest ABM B4JS class module with following content
Run ABM application in either Debug or Release mode and get unending spinning circle with the error message show above in the console log.
If I comment out these two lines
in TestPage's ConnectPage method, the ABM application runs (and displays the lonely button).
B4J version: 7.32
ABMaterial version: 4.51
Java: 8v212 and 11
I'm attaching the files that are different/new from the standard ABM Template. I've got a feeling that it is something silly on my end, I just can't see/find it.
b4jstest is the B4JS class module I created.ReferenceError: b4js_b4jstest is not defined TestPage.1561057241703.js:21:113
<anonymous> http://localhost:51122/Demo/TestPage/TestPage.1561057241703.js:21
Steps I performed:
Copy ABMaterial's Template and rename main file.
Add TestPage ABM Web Page class module. In BuildPage, create the following grid
B4X:
page.AddRowsM(1,True,20,0, "").AddCells12MP(1,0,0,0,0,"")
B4X:
Dim btnTest As ABMButton
btnTest.InitializeFlat(page, "btnTest", "", "", "Test Button", "")
btnTest.B4JSUniqueKey = "myb4jsid"
btnTest.B4JSOnClick("B4JSTest", "toast", Null)
page.Cell(1,1).AddComponent(btnTest)
B4X:
'Class module
Sub Class_Globals
' use Public or Dim if you want to share this variable over ALL B4JS classes
' use Private if only within this class
Public ABM As ABMaterial 'ignore, just to access the constants
Public Page As ABMPage 'ignore, just to be able to run ABMPage B4JS functions
End Sub
'Initializes the object. You can NOT add parameters to this method.
'MUST be called InitializeB4JS is automatically called when using this class
Public Sub InitializeB4JS
End Sub
public Sub toast()
Page.B4JSShowToast("1", "", "Hello World", 3000, False)
End Sub
#if JAVASCRIPT
#End If
If I comment out these two lines
B4X:
'btnTest.B4JSUniqueKey = "myb4jsid"
'btnTest.B4JSOnClick("B4JSTest", "toast", Null)
B4J version: 7.32
ABMaterial version: 4.51
Java: 8v212 and 11
I'm attaching the files that are different/new from the standard ABM Template. I've got a feeling that it is something silly on my end, I just can't see/find it.