I am having trouble with the following.
Basically IF the user forgets to Set the calendar, I want it to default to today, so:
var cal1 = form.getCalendar(“dt1”);
var d = new Date();
d.setDate(d.getDate() - 1);
cal1.setDate(d);
Althought IF I get use cal1.getDate() it returns the correct value, it does NOT show the date on the calendar.I have tried cal1.value(), cal1.label, etc …
I’ve been breaking my head on this for 3 days now!!!
I have the same problem.
Although the dhtmlXCalendar control does have the value but is not reflected in UI …
I’m using Knockout, but KO is not the problem
I using:
Product Name: dhtmlxSuite
Version: 5.0.2
Edition: Professional
ko.bindingHandlers.dhtmlXCalendar = {
init: function (element, valueAccessor, allBindingsAccessor) {
var calendar = ko.utils.domData.get(element, 'dhtmlXCalendar');
calendar.attachEvent("onChange", function (date, state) {
// Este evento no lo lanza shit!!!
});
calendar.attachEvent("onClick", function (date) {
var observable = valueAccessor();
observable(date);
});
},
update: function (element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
var _calendar = ko.utils.domData.get(element, 'dhtmlXCalendar');
if (_calendar) {
_calendar.setDate(value);
}
}
};