jQWidgets Forums

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • AhmedMostafa
    Participant

    Hello Martin,

    Thank you for your reply, but this couldn’t considered an acceptable solution.
    Because you are binding the click event to printButton in editDialogCreate which is invoked once only when the dialog created for the first time, so the parameter editAppointment will carry the values of the first open appointment forever (or will be undefined forever if we were attempting to create a new appointment), Hence we were forced to use the fields parameter to access the appointment data, so it’s cost us a lot of work-around to make it works as expected.

    Here is our solution in Angular 10:
    – Define new variable saveButton: any = null;
    – Added the following block of code to editDialogCreate

    
          // add custom save button
          let buttonElement = document.createElement("BUTTON");
          buttonElement.innerText = 'Save';
          buttonElement.style.cssFloat = 'right';
          buttonElement.style.marginLeft = '5px';
          buttonElement.id = 'SaveButton';
          fields.buttons[0].appendChild(buttonElement);
          let saveButton: jqwidgets.jqxButton = jqwidgets.createInstance('#SaveButton', 'jqxButton');
          this.saveButton = saveButton;
    

    – Then bind click event in editDialogOpen:

    
          // bind the event of save button
          var dataService = this.dataService;
          var scheduler = this.scheduler;
    
          this.saveButton.removeEventHandler('click');
          this.saveButton.addEventHandler('click', function () {
         
            if (editAppointment)
            {
              alert('Editing reservation: ' + editAppointment.id);
            }
    
            let data: any = {};
            data.resourceSetName = fields.resource.val();
            data.reason = fields.subject.val();
            data.recurrences =  [{
              "bookingFrom": fields.from.jqxDateTimeInput('getDate').toLocaleString(),
              "bookingTo": fields.to.jqxDateTimeInput('getDate').toLocaleString() //Bug: The scheduler adding extra 59 sec.!
            }];            
    
            dataService.createAppointment(data).subscribe((data: any) => {
             console.log(data);
              // The after Saving processes
              scheduler.closeDialog();
              ...
              ...
            }, (err: any) => {
              console.log(err);     
            });
    

    On the other hand, there are another serious issues:
    – The To field is adding extra 59 sec for all appointment, and It’s not manageable.
    – When the user attempts to create an new appointment from the month-view the time-part disappear from the datetime-picker, so he should open it first from the week-view once, to be able to edit the time-part.

    I hope you can solve these issues soon.

    Thank you,
    Ahmed Mostafa


    AhmedMostafa
    Participant

    Hi Peter,

    But that will not solve our issue! If we hide the save button, then how could we access the appointment data to validate it and send it to the back-end?

    We need to apply this scenario:
    1. User insert the required data and click save.
    2. We shall send the request to back-end.
    3. If the backend finished the process successfully, then we will show success message and close the dialog.
    4. Else if backend finished the process with some error, we should display the error message and let the user to modify his appointment (the dialog should be still open).

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