Hi there
I'm trying to build a floating action button, i have an iif method defined.
Depending on what the developer, specifies, there is some javascript that needs to be built and then somehow injected to the page. I think perhaps I will be able to use an Eval Method, still learning the ropes anyway.
I'm trying to build a floating action button, i have an iif method defined.
Depending on what the developer, specifies, there is some javascript that needs to be built and then somehow injected to the page. I think perhaps I will be able to use an Eval Method, still learning the ropes anyway.
B4X:
'injectjs
private Sub InjectJS
Dim script1 As String = $"$('#${ID}div').floatingActionButton({
hoverEnabled: ${iif(hoverEnabled,"true","false")},
direction:'${Direction}',
toolbarEnabled: ${iif(toolbarEnabled,"true","false")}});"$
Dim script2 As String = $"var inst${ID} = document.getElementById('${ID}');
var ${Instance} = M.FloatingActionButton.getInstance(inst${ID});"$
End Sub
'iif method
private Sub iif(Expression2Evaluate As String, ReturnIfTrue As Object, ReturnIfFalse As Object) As Object
If Expression2Evaluate = True Then
Return ReturnIfTrue
Else
Return ReturnIfFalse
End If
End Sub