We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Auto detect mobile device, and set scheduler view to day

Hi,

How might I auto detect whether or not the person viewing the scheduler component is on mobile, and then auto set the view to day instead of week?


1 Reply

SR Swathi Ravi Syncfusion Team January 23, 2023 12:55 PM UTC

Hi Andrew,


When the mobile mode is enabled, you can set the Day view automatically by using the ej base package Browser module isDevice property, as shown in the below-shared snippet.


Sample: https://stackblitz.com/edit/ttw3mi-h8ua46?file=index.js


[index.js]

var data = new ej.base.extend([], window.zooEventsDatanulltrue);

var scheduleObj = new ej.schedule.Schedule({

    width: '100%',

    height: '650px',

    selectedDate: new Date(2021115),

    views: [ej.base.Browser.isDevice ? "Day" : "Week"],

    eventSettings: { dataSource: data }

});

scheduleObj.appendTo('#Schedule');


Regards,

Swathi Ravi


Loader.
Up arrow icon