Get Resource Text (name) and ID on Custom Appointment Window

Greeting,

I am trying to build a custom appointment window, based on some of your examples, so far, I have been able to obtain the StartDate and StartTime into two separate fields, but I want to obtain the resource name and ID into two other fields. 


Here is my jquery code

        function onAppointmentWindowOpen(args) {

            args.cancel = true; // prevents the display of default appointment window

            var schObj = $("#schCalendario").data("ejSchedule");

            //When double clicked on the Scheduler cells, fills the StartTime and EndTime fields appropriately

            $("#StDate").ejDatePicker({ value: args.startTime }); //<-- works well

            $("#StTime").ejTimePicker({ value: args.startTime }); //<-- works well

            $("#txtRecurso") //<-- How to get the resource Text name into this field

            $("#txtIDRecurso") //<-- How to get the resource ID into this field

            $("#modNuevaCita").ejDialog("open"); //<--- works well

        }



Attachment: CalendarImage_821b2ace.zip

5 Replies

SK Satheesh Kumar Balasubramanian Syncfusion Team October 29, 2021 09:46 AM UTC

Hi Corando, 
  
Greetings from Syncfusion Support..! 
  
We have prepared a sample based on your shared query “need to load the resource field in the custom editor window while cell/appointment double click” using AppointmentWindowOpen event of the scheduler, which can be downloaded from the following link. 
  
  
    function onAppointmentWindowOpen(args) { 
        args.cancel = true; // prevents the display of default appointment window 
        var schObj = $("#Schedule1").data("ejSchedule"); 
        // When double clicked on the Scheduler cells, fills the StartTime and EndTime fields appropriately 
        $("#StartTime").ejDateTimePicker({ value: args.startTime }); 
        $("#EndTime").ejDateTimePicker({ value: args.endTime }); 
        $("#Category").ejDropDownList({ value: !ej.isNullOrUndefined(args.resources) ? args.resources.text : null }); 
. 
. 
. 
if (!ej.isNullOrUndefined(args.appointment)) { 
            $("#customId").val(args.appointment.Id); 
            $("#subject").val(args.appointment.Subject); 
            var categoryObject = $("#Category").data("ejDropDownList"); 
            var categoryValue = ej.DataManager(categoryObject.model.dataSource).executeLocal(new ej.Query().where("id", "equal", args.appointment.OwnerId))[0]["text"]; 
            $("#Category").ejDropDownList("clearText"); 
            $("#Category").ejDropDownList({ text: categoryValue, value: categoryValue }); 
. 
. 
. 
. 
} 
} 
  
Kindly try the above solution and get back to us if you need any further assistance. 
  
Regards, 
Hareesh 



CO Corando October 29, 2021 04:33 PM UTC

Thank you very much for your help, as provided the example works, however I have another question. 

The DropDownlist control in your example is filled manually, however, I would need the control to be filled from a database. Can it be done?


            $(function () {

                var categorize = [

                    { text: "ALDO", id: "326" },

                    { text: "DANIELA ALEJANDRA CRUZ GARCÍA", id: "364" },

                    { text: "FERNANDO JOSE MOYA SANCHEZ", id: "336" },

                    { text: "LAURA PATRICIA GOMEZ GOMEZ", id: "225" },

                    { text: "LUCERO MONSTSERRAT PEREZ SANCHEZ", id: "347" },

                ];  <---- These values should come from a database and are prefilled when the form loads.


                $("#Category").ejDropDownList({

                    dataSource: categorize,

                    fields: { text: "text", id: "id", value: "id" }

                });

            });



SK Satheesh Kumar Balasubramanian Syncfusion Team November 1, 2021 12:32 PM UTC

Hi Corando, 
  
Thanks for your update. 
  
Yes, you can fill the data from database. Please find the below sample link for more references. 
  
  
Could you please try the above solution and get back to us if you have any other queries? 

Regards, 
Satheesh Kumar B 



CO Corando November 2, 2021 09:36 PM UTC

Thank you, I got it working!

Cheers!




VM Vengatesh Maniraj Syncfusion Team November 3, 2021 08:54 AM UTC

Hi Corando, 
 
You are most welcome. 
 
Please get in touch with us if you need any further assistance. 
 
Regards, 
Vengatesh  


Loader.
Up arrow icon