jQWidgets Forums

jQuery UI Widgets Forums Scheduler How changedAppointments property works

This topic contains 15 replies, has 3 voices, and was last updated by  dalsword 8 years ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
  • How changedAppointments property works #80180

    MichaelIP
    Participant

    Hello,
    I’m trying to get changes I made to my appointments. For that, I use the changedAppointments property.
    According to the API; I expected to get an array of added/updated/deleted appointments.
    Meanwhile, the array contains only one occurrence, and as much properties as I have updated or deleted appointment, plus only one property for added appointment.

    The result of the property looks like that:
    changedAppointments data

    If I add several appointments, I only get the latest one. All others are lost…
    How can I get all the added appointments ? Should I process this somewhere else (such as the appoitmentAdd event) ?

    Other problem with this property, when I have a repeated appointment, if I read the changedAppointments property, this one through an error:

    Uncaught TypeError: Cannot read property 'weekday' of undefined
        a.jqx.ICalRule @ jqxscheduler.api.js:7
        c.toString @ jqxscheduler.api.js:7
        getDefaultSchedules @ CalendarTest.aspx:276
        onclick @ CalendarTest.aspx:634

    My code to get the property is the following:

     function getDefaultSchedules(method) {
                var fctResult = '';
                var schedules = null;
                var changes = null;
                switch (method) {
                    case 1:
                        schedules = $('#defaultScheduler').jqxScheduler('getDataAppointments');
                        break;
                    case 2:
                        schedules = $('#defaultScheduler').jqxScheduler('getAppointments');
                        break;
                    case 3:
                        changes = $('#defaultScheduler').jqxScheduler('changedAppointments');
                        console.log(changes);
                        break;
                }
    }

    Any help would be greatly appreciated !

    Many thanks.

    How changedAppointments property works #80184

    Peter Stoev
    Keymaster

    Hi MichaelIP,

    You can send us jsfiddle.net example with what you’re doing. We don’t understand your scenario.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    How changedAppointments property works #80196

    MichaelIP
    Participant

    Hi Peter.
    The JSFiddle is located at: https://jsfiddle.net/ks0Lgw6d/8/

    Concerning the error, in fact, this one is thrown when I want to get the value of recurrenceException property for a new repeated appointment.
    I thought that it was a string as indicated in documentation. It is an object…
    If you look at the JSFiddle, I have a repeated appointment.

    TEST 1:
    If you click on any of the buttons, you get the list of the appointments.
    The recurrentPattern is displayed as text in the last appointment.
    This done, add a new repeated appointment (whatever the repeat delay you want).
    Click again on the buttons to display the list of appointments ==> Error message !

    TEST 2:
    Reload the page (make sure you do not add a repeated appointment)
    Add a new appointment
    Click on the “changedAppointment” button ==> OK. The added appointment is listed.
    Add again a new appointment
    Click again on the “changedAppointment” button ==> KO. Only the last appointment is listed.
    If you make any changes to the other appointment, these updates are displayed at any click on the button. Therefore, I can suppose that changed list is not reseted ay each calls.

    The JSFildle does not works by itself as it needs a lot of external ressources throught HTTPS ! I do not have these files, but they are all usual jqx files.

    Many thanks for your help.

    How changedAppointments property works #80197

    Peter Stoev
    Keymaster

    Hi MichaelIP,

    recurrenceException is a string when you bind the Scheduler and stays a string for your data objects which are not used after that by the Scheduler. Inside the Scheduler they are objects, but I do not know why you need that at all. You should not use that. You can get the appointments representation using toString().

    The sample you sent me however does not open on my side

    Best Regards,
    Peter Stoev
    jQWidgets Team
    http://www.jqwidgets.com

    How changedAppointments property works #80198

    Peter Stoev
    Keymaster

    Hi MichaelIP,

    I tested locally and saw what you mean about changedAppointments. The issue is caused by a for..each inside addAppointment. I added a work item for that so in the next version of our Scheduler, this one would be resolved. changedAppointments can be easily simulated with custom array in your app

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    How changedAppointments property works #80253

    MichaelIP
    Participant

    Hello Peter,
    Many thanks for your feedback.

    I’m making a loop in changes as I need to check all changes which occurs in the scheduler in order to propagate this changes in the database.
    Whatever the way I use, when I insert a new repeated appointment, the scheduler throw an error.
    I’ve tested that by geting property changedAppointments, calling the getDataAppointments or getAppointments functions.
    Same problem occurs when I’m listening the appointmentChange, appointmentAdd or appointmentDelete events.
    Trying to get the recurrentPattern of the appointment generates this error:
    Uncaught TypeError: Cannot read property 'weekday' of undefined

    This problem occurs if I try to get it using toString()…
    var recurrence = schedule.recurrencePattern.toString();

    Knowing that 99% of our appointments will be recurrent, it will be hard to store them in the database !

    Any chances to get also this problem corrected ?

    Many thanks.

    How changedAppointments property works #80255

    Peter Stoev
    Keymaster

    Hi MichaelIP,

    I cannot reproduce Uncaught TypeError: Cannot read property ‘weekday’ of undefined. The jsfiddle which you sent me shows nothing, too, because the Scheduler in it even does not run.

    Best Regards,
    Peter Stoev
    jQWidgets Team
    http://www.jqwidgets.com

    How changedAppointments property works #80261

    MichaelIP
    Participant

    Peter,
    Using JSFiddle, I don’t know how to use external ressources which are not on HTTPS !
    That’s why the JSFiddle does not works…

    You can get a working copy of it at http://test-jqx.mcp-network.fr/.

    You will be able to see the source and then reproduce the problem, which can be seen in any debug console.

    Many thanks for your support on this problem which is really a blocking problem for us.

    How changedAppointments property works #80295

    Peter Stoev
    Keymaster

    Hi MichaelIP,

    I reproduced the reported behavior about “weekday” and created a work item. Unfortunately, there is no workaround available.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    How changedAppointments property works #80298

    MichaelIP
    Participant

    Hello Peter,

    I will wait until this problem is corrected o a workaround is available.

    Many thanks Peter for your support on this problem.

    Regards.

    Michael

    How changedAppointments property works #80432

    MichaelIP
    Participant

    For those who like me need this feature, I wrote a function returning the needed string :

        
        function getRecurrencePattern(recurrencePattern) {
    
            fctResult = '';
            try  {
                fctResult = recurrencePattern.toString()
            }
            catch (err) {
                err += '. Trying to get recurrencePattern by code !';
                console.log(err);
                var freqency = recurrencePattern.freq.toUpperCase();
    
                var byDay = '';
                var byMonth = '';
                var byMonthDay = '';
                var count = recurrencePattern.count;
                var interval = recurrencePattern.interval;
                var until = recurrencePattern.to.toString('yyyyMMddTHHmmssZ');
    
                switch (freqency) {
                    case 'WEEKLY':
                        var checkedDays = recurrencePattern.byweekday;
                        for (var index = 0; index < checkedDays.length; index++) {
                            if (byDay != '') {
                                byDay += ',';
                            }
                            byDay += getWeekDayName(checkedDays[index]);
                        }
                        break;
                    case 'MONTHLY':
                        var checkedMonthDay = recurrencePattern.bymonthday;
                        var checkedMonthWeekDay = recurrencePattern.bynweekday;
                        if (checkedMonthDay != null) {
                            for (var index = 0; index < checkedMonthDay.length; index++) {
                                if (byMonthDay != '') {
                                    byMonthDay += ',';
                                }
                                byMonthDay += checkedMonthDay[index];
                            }
                        }
                        if (checkedMonthWeekDay.length != 0) {
                            byDay = checkedMonthWeekDay[0][1].toString() + getWeekDayName(checkedMonthWeekDay[0][0]);
                        }
                        break;
                    case 'YEARLY':
                        var checkedYearDay = recurrencePattern.byyearday;
                        var checkedMonthes = recurrencePattern.bymonth;
                        var checkedMonthWeekDay = recurrencePattern.bynweekday;
                        if (checkedYearDay != null) {
                            for (var index = 0; index < checkedYearDay.length; index++) {
                                if (byMonthDay != '') {
                                    byMonthDay += ',';
                                }
                                byMonthDay += checkedYearDay[index];
                            }
                        }
                        if (checkedMonthes.length != 0) {
                            byMonth = checkedMonthes[0];
                        }
                        if (checkedMonthWeekDay.length != 0) {
                            byDay = checkedMonthWeekDay[0][1].toString() + getWeekDayName(checkedMonthWeekDay[0][0]);
                        }
                        break;
                }
    
                fctResult = 'FREQ=' + freqency;
                if (count != 1000) {
                    if (fctResult != '') fctResult += ';';
                    fctResult += 'COUNT=' + count;
                }
                if (until != '99991231T000000Z') {
                    if (fctResult != '') fctResult += ';';
                    fctResult += 'UNTIL=' + until;
                }
                if (byDay != '') {
                    if (fctResult != '') fctResult += ';';
                    fctResult += 'BYDAY=' + byDay;
                }
                if (byMonthDay != '') {
                    if (fctResult != '') fctResult += ';';
                    fctResult += 'BYMONTHDAY=' + byMonthDay;
                }
                if (byMonth != '') {
                    if (fctResult != '') fctResult += ';';
                    fctResult += 'BYMONTH=' + byMonth;
                }
                if (interval != 1) {
                    if (fctResult != '') fctResult += ';';
                    fctResult += 'INTERVAL=' + interval;
                }
    
            }
            return fctResult;
        }

    It works pretty fine.
    The string returned by the function is stored in database. After reloaded appointments, repeated appointments are displayed the same way when created by the widget.
    I have just a problem with the Yearly repeated appointments. The returned string seems to be correct but the jqxScheduler cannot load it !

    Hope this can help someone.
    Regards.

    How changedAppointments property works #80434

    Peter Stoev
    Keymaster

    Hi MichaelIP,

    Hope you have a valid Developer/Enterprise license. Otherwise, the code you have written is obviously written after reverse engineering our own code and that is in violation with our EULA as written in it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    How changedAppointments property works #80436

    MichaelIP
    Participant

    Hi Peter,

    I’ve just looked at the object itself to understand how does it works. Using this object properties, I guess what should be done in order to reach my needs.
    I do not make any reverse engineering on your code or use any other resources.
    The only thing I did has been looking to the reccurrencePattern properties using the Chrome debugger. While making tests, I understood how your widget works. If I had a look to your code, I surely had the same problem about ‘weekday’.

    Concerning the license, I’m currently evaluating your product. I’ve already spent around 15 days and still needs the last 15 remaining days allowed on the 30 days evaluation version to fully terminate this evaluation. Our needs are not fully satisfied with what the jqxScheduler offers. We choose this widget because most of our needs were already available. As soon as I will finished, I will present my work to my company. I think your product will be accepted by my company and therefore, we will buy a license. Our final product does not meet the non-commercial use. That’s why I’m testing the evaluation version.

    If I made a mistake posting this piece of code, I’m really sorry. I do not want to cause problems. I just thought helping people who like me needs this feature. I apologize about this problem. If it is a problem for you, you can of course delete the post.

    Regards.

    How changedAppointments property works #80442

    Peter Stoev
    Keymaster

    HI Michael,

    Thanks for clarification. No problem from us. Which features are you missing in the Schesuler.

    Regards,
    Peter

    How changedAppointments property works #80482

    MichaelIP
    Participant

    Hello Peter,
    The missing features we need in your components is maybe also linked to a lack of knowledge of this component.
    As you may have understood, we works mostly on repeated appointments (around 90% of our appointment are repeated one).

    The main missing features is how to get back information on modified or deleted appointments. Also, in order to have a customized context menu, having information on these appointments could be great. Nowadays, I do not find a way to get information when working with repeated appointment.

    After making a few tests on deleting only one recurrence of an appointment, I notice that by editing (and saving) a non-updated appointment, I get back the deleted occurrence in the recurrenceException property. This way of sasving data not really user-friendly but may be used as a work-around until a better way to do this is available.
    Unfortunately, if I update an appointment instead of deleting it, I see that this appointment is also set into the recurrenceException property. I can’t therefore guess if the exception concerns a deleted or an updated appointments.

    I will try to get deleted appointments by managing the appointementDelete event and by combining the changedAppointments property. I meanwhile need also to reset the changedAppointments once the process done in order not to process twice the changes. I absolutely don’t know how to reset the changedAppointments… This may be done by another workaround (such as reloading data)…

    Any help on managing changes/deletion on repeated appointments would be really appreciated.

    Many thanks

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.