jQuery UI Widgets Forums Getting Started Get Active Appointment in a Timespan

This topic contains 5 replies, has 2 voices, and was last updated by  Hristo 3 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Get Active Appointment in a Timespan #114666

    olegb
    Participant

    Let me preface that I’m a new user and so far love this product!

    Quick question: If we setup a number of appointments, with some of them recurring, is there a “simple” way that we can query the system to know what appointment is currently active within some timespan. Specifically, if we setup a recurring appointment (repeat daily, at 10 am, for example)… and we are a week from today, how can we query the system and see that this appointment is active at 10am that day?

    I hope I’m explaining myself correctly.

    Thanks in advance,
    Oleg

    Get Active Appointment in a Timespan #114673

    Hristo
    Participant

    Hello Oleg,

    About the mentioned scenario I think you could get all appointments via the getAppointments method.
    With custom logic and the renderAppointment callback, you could customize a specific appointment.
    Also, I would like to suggest you look at this example:
    http://jsfiddle.net/txhi/orqd6d5q/

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

    Get Active Appointment in a Timespan #114682

    olegb
    Participant

    Hristo,

    Thank you for your reply. So, if I understand you correctly, the strategy/approach you are suggesting is to getappointments in, render them and then see what appointments are active on a particular date/time (how?). So, if this is what I think you are saying, means that we would have to visually render something before we know if the appointment is there. Is there any way to get that without rendering?

    Apologies if I misunderstand your approach.

    Thank you,
    Oleg

    Get Active Appointment in a Timespan #114692

    Hristo
    Participant

    Hello Oleg,

    If the main purpose is to recognize the appointments on some specific timespan (before showing) then this logic will be better to handle on the server.
    In case that you want to check the records before they are loaded in the jqxScheduler, you could use the beforeLoadComplete callback of the DataAdapter.
    About the visualization approach you could try this code snippet:

    $("#getdata").click(function() {
    	var appointmentsData = $("#scheduler").jqxScheduler("getAppointments");
    	var today = new Date();
    	console.log("These appointments should be checked");
    	for (var i = 0; i < appointmentsData.length; i++) {
    		var currentAppointment = appointmentsData[i];
    		var to = currentAppointment.to;
    		var comparisonDate = new Date(to.year(), to.month(), to.day());
    		
    		if (today - comparisonDate <= 0) {
    			console.log(currentAppointment);
    		}
    	}
    });

    Please, let me know if you have any other questions related to the library.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

    Get Active Appointment in a Timespan #114712

    olegb
    Participant

    Hriso,

    Thank you! It makes sense.

    Regarding your comment “If the main purpose is to recognize the appointments on some specific timespan (before showing) then this logic will be better to handle on the server.” do you know of any tools/libraries/techniques to do that easily? My biggest concern is how to interpret the recurring format string to match into a specific future timespan. That is, if something repeats every other day, how can I know that it will hit June 23, 2021 as an example? Not sure if I’m phrasing this correctly, but hope you understand.

    Thanks again for the help so far,
    Oleg

    Get Active Appointment in a Timespan #114735

    Hristo
    Participant

    Hello Oleg,

    I would like to suggest you try to use this example as a base to discuss this case.
    Unfortunately, I am not able to provide you a better solution with the current API.
    You could check the appointment if it is a recurrence appointment by the recurrencePattern member if this exists then it is such.
    If we drow deeper you could check the frequency of this appointment by the freq member.
    The next two useful options are count and weekDays members.
    You could find more useful details in the appointmentDataFields property.
    Please, take a look at the API Documentation page.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.