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
}
|
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 });
.
.
.
.
}
} |
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" }
});
});
Thank you, I got it working!
Cheers!