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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Obtain new appointment data #95662

    ch3s
    Participant

    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,
    Vlad

    Obtain new appointment data #95669

    Hristo
    Participant

    Hello 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-90388

    I 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 Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Obtain new appointment data #95675

    ch3s
    Participant

    Thanks Hristo,
    will look into it.

    Kind Regards,
    Vlad

    Obtain new appointment data #95685

    ch3s
    Participant

    Still …… 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,
    Vlad

    Obtain new appointment data #95736

    ch3s
    Participant

    so 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

    Obtain new appointment data #95785

    Hristo
    Participant

    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 Hristov

    jQWidgets team
    http://www.jqwidgets.com

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.