Search code examples
javascriptjquerydevextreme

Hide or disable for edit properties in DevExtreme Scheduler and another questions?


I have an working scheduler which works with json data coming from ajax call. The problems i seem to not be able to find in documentation are:

  1. How can i "disable" start/end date and remove Description (for example) in the edit pop up so they wont be changeable/visible? I only want to edit the schedule name.
  2. How can i make the scheduler 'focus' on a specific schedule coming from the db? I have a filter which returns only one schedule but if its not in the current date it won't show up and i have to navigate manually to the date where the schedule is to see it, is there an option for that? The only way i think i can achieve that is to get the date and set it to the currentDate property, but is that possible in some way?

Solution

  • 1) To customize the appointment form use the onAppointmentFormCreated event. See this demo, as well.

    2) To navigate a scheduler to the particular date use the currentDate option. The sample below shows how to do it using the onContentReady option:

    $("#scheduler").dxScheduler({
        /*...*/
        // set default current date too old for demo
        currentDate: new Date(2010, 4, 18),
        onContentReady: function(e) {
            // get all loaded appointments
            var appointments = e.component.getDataSource().items();
            // navigate to the first appointment
            e.component.option("currentDate", new Date(appointments[0].startDate));
        }
    });
    

    https://jsfiddle.net/wn6jqdfn/