This is a migrated thread and some comments may be shown as answers.

[Solved] Intercept OnNavigate Event

0 Answers 28 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Keiichi-kun
Top achievements
Rank 1
Keiichi-kun asked on 15 May 2013, 10:38 AM
Hi,
I've a DatePicker like this

@(
Html.Telerik().DatePickerFor(m => m.dip_Data)

                .Name("MyDate")

                .HtmlAttributes(new { id = "DateTime_wrapper", style = "position: relative; width: 200px;" })

                .Format("MMM yyyy")

                .ClientEvents(events => events.OnOpen("Picker1_Open").OnChange("Picker1_Change"))
)


I need to view only year/month combination while navigating.
I set Year as default view in OnOpen event:

function Picker1_Open(e) {
    e.preventDefault();
    e.stopPropagation();
    var picker = $(this).data("tDatePicker");
    var calendar = picker.dateView._getCalendar();
    picker.open();
    if (!this.value) {
        var myDate = new Date();
        myDate = new Date(myDate.getFullYear(), myDate.getMonth(), 1)
        var stopAnimBU = calendar.stopAnimation;
        calendar.stopAnimation = true;
        calendar.navigateVertically(2, myDate, false);
        calendar.stopAnimation = stopAnimBU;
    }

and everything works fine.

Now I would like to intercept in any possible way the event "OnNavigate", so I can force navigateVertically to return to month view if someone try to go to day view. Obviously this is an horrible solution...
I didn't find any "OnNavigate" event and no event seems to be fired during navigation.
Any help about this?

Thanks

K.
Tags
Date/Time Pickers
Asked by
Keiichi-kun
Top achievements
Rank 1
Share this question
or