Home Unanswered Active Tags New Question

DaypilotNavigator JS-select incorrect behaviour

Hello.

When use dpn.select(dt) with dt not in visible range navigator should always switch to month which contains selected date.

Now the logic is sometimes incorrect, especially when you try to implement "prev - next" logic. It seems that you use a 90 days interval logic to switch visible range. It is not correct, it must be more complex. Just try dt.AddDays(7) and you will see that switching not always happens when you expect it to happen.

The logic should be somthing like that:

with (DPNavigator) {
var endDate = startDate.addMonths(showMonths);
if ((selectionStart.d < startDate.d && selectionEnd.d < startDate.d) || (selectionStart.d >= endDate.d && selectionEnd.d >= endDate.d)) {
moveMonth((selectionStart.d < startDate.d ? -1 : 1) * skipMonths);
}

Asked by Dmitry 11 months ago.
Replies

Or maybe more simple: you can just check if selection is visible by cssClass and if not then switch to needed month

Comment posted by Dmitry 11 months ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java