'Class module
Sub Class_Globals
Public AbTbl As ABMTable ' need to be public
Private ABM As ABMaterial 'ignore
Private TargetPage As ABMPage
Private ObjectId As String
End Sub
' new part, we give the class it's own ParseEvent method
public Sub ParseEvent(params As Map)
Dim eventName As String = params.Get("eventname")
Dim eventParams() As String = Regex.Split(",",params.Get("eventparams"))
' Important! Here we remove the 'parent' part, so we can re-use the this component, as the events will have the same name
' e.g. myTopBar2aBtn1_Clicked will become Btn1_Clicked
eventName = eventName.SubString(ObjectId.Length)
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 directly, to many param
CallSub2(Me, eventName, params)
End Select
End If
End Sub
'Initializes the object. You can add parameters to this method if needed.
public Sub Initialize(page As ABMPage, id As String, Headers() As String)
TargetPage = page
ObjectId = id
AbTbl.Initialize(TargetPage, ObjectId & "tbl", False, False, True, "") ' here also we need to have a 'fixed' part of the id to receive the events
AbTbl.SetHeaders(Headers)
AbTbl.SetColumnDataFields(Headers)
AbTbl.IsResponsive = True
AbTbl.EventHandler = Me ' NEW
Private HeadThemes As List
HeadThemes.Initialize
For i = 0 To Headers.Length - 1
HeadThemes.Add("")
Next
AbTbl.SetHeaderThemes(HeadThemes)
AbTbl.IsBordered = True
End Sub
Sub tbl_Clicked(PassedRowsAndColumns As List)
Log("Clicked")
End Sub