B4J Question [BANano] Using html template

Discussion in 'B4J Questions' started by Luk, Apr 16, 2019.

  1. Luk

    Luk Member Licensed User

    Hi,

    Is it possible to specify a html template and add the generated javascript to this html file ?
    e.g.
    Code:
    BANano.HTML_TEMPLATE = "my template.html"
    Or should I use the following method. (javascript is adding the elements)
    Code:
    Dim j As BANanoElement
        j = BANano.GetElement(
    "body")  
        j.Append(
    $"
        <div id='content'>      
                <button id="defaultButton">Default</button>
                <button id="primaryButton">Primary</button>
                <button id="infoButton">Info</button>
                <button id="successButton">Success</button>
                <button id="warningButton">Warning</button>
                <button id="dangerButton">Danger</button>
                <button id="inverseButton">Inverse</button>
                <button id="linkButton">Link</button>
            </div>
        "$
    )
    Thanks !
     
  2. alwaysbusy

    alwaysbusy Expert Licensed User

    You can use BANano.Initialbody = html, but only in AppStart(). The html will be written in the body tag.
     
    Luk likes this.
  3. Kiffi

    Kiffi Well-Known Member Licensed User

    You could load templates via CallAjax():

    Code:
    Sub ...

      BANano.CallAjax(
    "./assets/MyTemplate.html""GET""text"Null"MyTemplate"False, CreateMap())

    End Sub

    Sub BANano_CallAjaxResult(Success As Boolean, UniqueID As String, Result As String)
     
      
    If Success Then
        
    Select UniqueID
          
    Case "MyTemplate"
            BANano.GetElement(
    "body").Append(Result)
        
    End Select
      
    End If
     
    End Sub
    Greetings ... Peter
     
    Mashiane, alwaysbusy and Luk like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice