Search code examples
jsonoutsystems

Issue with the EnabledDays in the Calendar widget


I am using the Enabled days in the Calenadr widget , the enabled days are the days when the data load happens. Data Load dates are stored in the entity and whenever the dataload happended those dates needs to be enabled in calendar. I am using the action to select those dates in

enter image description here

The issue is it display the dates in when the dataload happened in 2015 even in this 2016. When I debug and see the JSONValidDate it is like

enter image description here

Now the problem is it selects these date even in 2016, but these dates dataload happened in 2015.

So I added year year to variable and the value is

enter image description here

And it doesnot work, It doesnot open the calendar. I am really stuck and not sure how to proceed with this. This is in production and I am not able to move forward. Any help is greatly appreciated.


Solution

  • From what I can see you are using the Silk UI Framework.

    The EnabledDays from the Silk UI Calendar does not allow you to select the year, so when you add the year to the JSON, the calendar does not know what to do with it, and returns an exception to the browser's console.

    However, there are 2 options to solve this issue:

    1. You can use another element (in the image bellow I used a buttongroup) to filter the year outside the calendar. Then, by doing an Ajax Refresh, get the data for that year and refresh the calendar.

    Check this image for the example

    1. You can copy the calendar pattern to your own application and change the EnableDays code to also work with the year.

    As you may have noticed on this last image, this calendar pattern is deprecated (since Version 1.1.0, released on 16 July 2015), and the new version of the calendar, does the exact opposite, which is select the disabled dates.

    Although this second option is a bit harder to implement, and having in consideration that at a certain point the deprecated patterns may be deleted, it will allow you to keep upgrading Silk UI without loosing any functionality to your application.