B4J Question Banano help

roberto64

Active Member
Licensed User
Longtime User
Hi, I'm running into javascrit datepicker of "gijgo.min.js", at first it worked in the browser, after a while it didn't work anymore, where I'm wrong.
banano:
Sub AppStart (Form1 As Form, Args() As String)
    PublishFolder = "C:\Users\roberto\Desktop\usbwebserver_v8.6.2\root"
    PublishFolder = File.dirapp
    BANano.Initialize("BANano", ShortName,DateTime.Now)
    BANano.UseServiceWorker = False
    BANano.HTML_NAME = "index.html"
    BANano.Header.Title = AppName
   
    'righe gijgo
    BANano.Header.AddJavascriptFile("https://code.jquery.com/jquery-3.3.1.min.js")
    BANano.Header.AddJavascriptFile("https://unpkg.com/gijgo@1.9.13/js/gijgo.min.js")
    BANano.Header.AddCSSFile("https://unpkg.com/gijgo@1.9.13/css/gijgo.min.css")
'    BANano.Header.AddCSSFile("datepicker.css")
'    BANano.Header.AddJavascriptFile("datepicker.js")
'    BANano.Header.AddCSSFile("core.css")
'    BANano.Header.AddJavascriptFile("core.js")
    BANano.Header.AddCSSFile("https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css")
    'BANano.Header.AddJavascriptFile("https://unpkg.com/gijgo@1.9.13/js/gijgo.min.js")
    'BANano.Header.AddCSSFile("https://unpkg.com/gijgo@1.9.13/css/gijgo.min.css")
   
   
    BANano.Build(PublishFolder)
   
    Dim appPath As String = File.Combine(PublishFolder,ShortName)
    Dim url As String = File.GetUri(appPath,"index.html")
'    If PublishFolder <> File.DirApp Then url = $"http://localhost//${ShortName}/index.html"$
    fx.ShowExternalDocument(url)
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub BANano_Ready()
   
BANano.GetElement("#body").empty
    BANano.LoadLayout("#body","vCountries")
    BANano.GetElement("#body").SetStyle($"{"padding": "8px"}"$)

    Dim mName As String = "datepicker"
Dim mvari As Map
    mvari.Put("width","200")
bo.Initialize("$")
   
    datepicker1 = bo.Selector($"#${mName}"$)'.RunMethod("datepicker",Null)
    datepicker1.RunMethod("datepicker",Null)
'    BANano.GetElement("#body").Append($"<input id=datepicker ></input>"$)
'    BANano.GetElement("#body").RunMethod("datepicker", Null)


    End Sub
Thank you
 

Mashiane

Expert
Licensed User
Longtime User
Some Assumptions

1. I assume you have an element added to the page called datepicker, e.g. <div id="datepicker"></div>. On the code above it does not seem to be added to the html part of the page.
2. You have not set any options for the date e.g. fontui to use, date format etc - this is fine.
3. You have included the font files that come with gijgo, it uses material & fontawesome.
4 My best bet is that you run a .destroy first and also attend to point 1.

This is my code for example that I'm using..


B4X:
'refresh the grid
Sub Refresh As VMGijgoDatePicker
    If boTP <> Null Then boTP.RunMethod("destroy", Null)
    'initialize jquery
    boTP = JQ.Selector($"#${ID}"$)
    boTP.RunMethod("datepicker", Array(options))
    Return Me
End Sub

Good luck.

Advise: In your questions, rather write them like this: [BANano] - Gijgo Date Picker Rendering Help
 
Last edited:
Upvote 0
Top