B4J Question ABMCalendar ABMaterial v5.12 BUG

walterf25

Expert
Licensed User
Longtime User
I added a calendar object with the default view to MONTH, for some reason when I click on any of the days the _DayClicked(date As String) does not fire up, below is the code where I initialize the object.
Calendar Object:
    DateTime.DateFormat = "yyyy-MM-dd"
    Log("today is: " & DateTime.Date(DateTime.Now))
    calendar.Initialize(page, "calendar1", DateTime.Date(DateTime.Now), ABM.FIRSTDAYOFWEEK_MONDAY, "en", ABM.CALENDAR_DEFAULTVIEW_MONTH, "calendartheme")
    calendar.Editable = True
    calendar.UseTheme("calendartheme")

and here are the events that are supposed to fire up when clicking on any day.
Calendar Events:
Sub calendar1_DayClicked(date As String)
    Log("date clicked: " & date)
End Sub

Sub calendar1_EventClicked(eventId As String)
    Log("event clicked: " & eventId)
End Sub

Sub calendar1_FetchData(dateStart As String, dateEnd As String)
    Log("fetchData: " & dateStart & " / " & dateEnd)
End Sub

Is this a bug or am I missing something here?

I noticed that on the Demo the ABMaterial version 4.3 is being used and when testing on the Demo project, the _DayClicked(date As String) events gets raised just fine, I started working on my project with the latest version so I can't just go back to version 4.3.

Walter
 

MichalK73

Well-Known Member
Licensed User
Longtime User
I checked your code.
It works flawlessly returns the date when pressed.
Don't you have js,css mixed up in your project ?
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
I checked your code.
It works flawlessly returns the date when pressed.
Don't you have js,css mixed up in your project ?
that's interesting, are you using version 5.12?

Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
if you go to js folder what version does your abmcalendar js file say, mine says 3.0 abmcalendar.3.00.min.js.

Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
yeah, same here.
It seems the problem is because I am adding the calendar object inside a container, basically I have an ABMTab component, on the first tab's container I add the ABMCalendar object, I just tried adding the ABMCalendar object to the page, like this "Page.cell(1,1).addComponent(calendar)" and the click event works fine, but when I move the calendar back to the Tab's container then the click event stops working.

Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
I just realized also that the calendar object doesn't obey the default date setting, for example I set the default to be 2024-04-12, April 12th 2024 and it doesn't obey that setting.

Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
So, I uncommented the log(eventname) line at Page_ParseEvent function, and the eventname logged is the following:
containertab1-calendar1_dayclicked
So it seems that I would need to change the calendar Click event to that, but if I try to do that I get an error telling me the function signature is wrong.

Why is the eventName returning the calendar's parent name, it doesn't do this on previous versions.

Is there a way to bypass this?
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
For now, I added this code at the top of the Page_ParseEvent( params As Map) function to catch the calendar event name, it works this way but hopefully @alwaysbusy can take a look and fix the issue.

B4X:
    Dim group() As String
    If eventName == "containertab1-calendar1_dayclicked" Then
        group = Regex.Split("-", eventName) '' split eventName at dash "-"
        eventName = group(1).Trim ''' get the second line after splitting which should be calendar1_dayclicked
    End If

Walter
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…