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

Setting views based on viewport

3 Answers 25 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 22 Jun 2015, 10:38 PM
I was wondering if there is a way to set the view to either day or week based upon screen size within a scheduler view model? The scheduler I am trying to build will display the day view in mobile portrait and week view in mobile landscape. Your help is much appreciated! 

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 24 Jun 2015, 03:38 PM
Hello George,

You can use the "onorientationchange" event to detect when the orientation is changed and change the current view using the "view" method of the scheduler. Please check the example below:

$(window).on("orientationchange",function(e){
    //detect the orientation
     var scheduler = $("[data-role=scheduler]").getKendoScheduler();
    scheduler.view("week"); //or 'day' depending on the orientation
});

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Tony
Top achievements
Rank 1
answered on 28 Sep 2015, 09:13 PM

Hey Vladimir,

This works. However, I noticed that if the edit event window is opened, and if a user rotates the mobile device from portrait to landscape, the edit event window closes and does not reopen when the view is reset. How can i prevent this from happening?

0
Vladimir Iliev
Telerik team
answered on 30 Sep 2015, 07:55 AM
Hello George,

The desired behavior of preserving the edit window when switching views is not supported out of the box and custom solution would be required. Possible solution is to use the "dataBinding" event to detect if there is edit window to save it's UID  / ID and use it on next "dataBound" event to edit the event again using "edit" method.

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Tony
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Tony
Top achievements
Rank 1
Share this question
or