jQuery UI Widgets › Forums › Scheduler › Obtain new appointment data
This topic contains 5 replies, has 2 voices, and was last updated by Hristo 7 years, 9 months ago.
-
Author
-
Dear Community,
I’m trying to obtain data from new appointment to be sent over ajax/json to server side, any ideas how I can do that?Currently using event:
$(“#scheduler”).on(‘appointmentAdd’, function (event) {
var args = event.args;
var appointment = args.appointment;and there is ajax call inside:
$.ajax({
type: “POST”,
dataType: ‘json’,
contentType: ‘application/json’,
url: ‘${pageContext.request.contextPath}/dpc?c=add’,
data: JSON.stringify(appointment),but it is not what I need, also fields are a bit customized:
editDialogCreate: function (dialog, fields, editAppointment) {
// hide repeat option
//fields.repeatContainer.hide();
// hide status option
fields.statusContainer.hide();
// hide timeZone option
//fields.timeZoneContainer.hide();
// hide color option
//fields.colorContainer.hide();
fields.subjectContainer.hide();
fields.allDayContainer.hide();
fields.locationContainer.hide();var source2 = [
“Affogato”,
“Americano”,
“Bicerin”,
“Breve”,
“Café Bombón”,
“Café au lait”,
“Caffé Corretto”,
“Café Crema”,
“Caffé Latte”,
];fields.colorLabel.html(“Client”);
fields.color.jqxDropDownList({ source: source2, placeHolder: “Select Client:”, displayMember:”clients”, valueMember:”id” });fields.repeatLabel.html(“Activity”);
fields.repeat.jqxDropDownList({ source: source2, placeHolder: “Select Activity:”, displayMember:”Activity”, valueMember:”id” });fields.timeZoneLabel.html(“Agent”);
fields.timeZone.jqxDropDownList({ source: source2, placeHolder: “Select Agent:”, displayMember:”agents”, valueMember:”id” });//fields.fromLabel.html(“Start”);
},
appointmentDataFields:
{
activity: “activity”,
id: “id”,
agent: “agent”,
client: “client”,
from: “from”,
to: “to”,
description: “description”
},it is a bit messy, I’m new to JS Widgets deep dive so bear with me
Kind Regards,
VladHello Vlad,
I would like to suggest you this forum topic, it is about how to Create, Remove and Update an appointment:
http://www.jqwidgets.com/community/topic/add-delete-update-change-appointment/#post-90388I suspect that you want to do customizations in the (Create/Edit) ‘dialog’ for this purpose, please take a look at this demo:
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxscheduler/scheduler-edit-dialog.htm?light
(it shows how to add a new button)Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comThanks Hristo,
will look into it.Kind Regards,
VladStill …… I can’t access the data from the fields:
$(“#scheduler”).on(‘appointmentAdd’, function (event) {
var args = event.args;
var appointment = args.appointment;
$(“#log”).html(“appointmentAdd is raised”);
alert(appointment.activity);in the data fields I have activity – alert gave undefined.
Kind Regards,
Vladso finally this whole thingy translates in my inability to access appointmentDataFields, from the above sample all attempts fails:
appointment.repeat, appointment[‘repeat’] (for example), I did some reflection and I can see there is repeat field:for(var key in appointment) {
if(appointment.hasOwnProperty(key) && typeof appointment[key] !== ‘function’) {
alert(key);
}
}so I’m a bit puzzled, this translates probably into JS know-how rather then specific jqWidget
Hello Vlad,
I would like to suggest you use
console.log
only the appointment variable. You will see one object with all datafields from the ‘dialog’ (from this new one appointment).
Please, take a look at this example.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.