Marking the selected day in month view

Hi All,

I want to change the background colour of the selected day in the onEmptyClick event, but cannot seem to be able to get it working.

my current code is:

        scheduler.attachEvent("onEmptyClick", function (x_ind, y_ind, x_val, y_val, e) {
            var day = x_ind.getDate();
            var month = x_ind.getMonth();
            var year = x_ind.getFullYear();
            var oldDate = new Date($('#selectedDate').val());
            var newDate = new Date(year, month, day);

            scheduler.deleteMarkedTimespan({
                days: oldDate
            });

            scheduler.addMarkedTimespan({
                days: newDate,
                zones: "fullday",       // marks the entire day
                type: "dhx_time_block",
                css: "selected"   // the applied css style
            });

            $('#selectedDate').val(x_ind);
        });

selectedDate is a hidden field I use to store the selected date.

Am I doing something wrong or is this not supported in the way I want to use it?

Thanks,
Lee

Hi,

I couldn’t reproduce the issue with your code http://snippet.dhtmlx.com/ea66ddb99

I think you need to use getActionData() method to get the target date

Use this sample as an example. It demonstrates almost the same, but onMouseMove event is used instead of onEmptyClick.