jQWidgets Forums

Forum Replies Created

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

  • KevinMbitkebeyo
    Participant

    Hi, I have already tried this method you propose and it works very well. The problem is that I would like to update the data from the scheduler form. The default id I get is a string. When I do a console.log of the data I get this is what I get:

    {subject: ‘yuzey’, description: ”, start: Fri Sep 30 2022 00:00:00 GMT+0200 (heure d’été d’Europe centrale), end: Fri Sep 30 2022 23:59:59 GMT+0200 (heure d’été d’Europe centrale), id: ‘1821-26-19-30-25’}

    As you can see the id is a string and I would like to change it with the server id directly. How to do this please?


    KevinMbitkebeyo
    Participant

    Hi, please the solution you gave me did not work. In fact what I would like to do is to get the id that is in the server in order to modify it using the scheduler fields. The id that I get in the scheduler appointment is this one: “2226-22-23-16-29”. Here is how I implemented the relief you proposed:

    ngAfterViewInit(): void {
    this.myScheduler.ensureAppointmentVisible(‘id1’);
    let appointments = new Array();
    const datas = this.calService.getCalendars().subscribe(
    (data) => {
    this.events = data;

    for (let i = 0; i < this.events.length; i++) {
    const singleEvent: schedulerInter = {
    id: null,
    subject: null,
    start: null,
    end: null,
    };
    singleEvent.end = new Date(this.events[i].enddate);
    singleEvent.id = this.events[i].id;
    singleEvent.start = new Date(this.events[i].startdate);
    singleEvent.subject = this.events[i].event;
    appointments.push(singleEvent);
    }
    },
    (error) => {
    console.log(error);
    },
    () => {
    appointments.forEach((appointment) => {
    this.myScheduler.addAppointment(appointment);
    });
    },
    );

    this.myScheduler.source(new jqx.dataAdapter(this.resources(datas)));
    }


    KevinMbitkebeyo
    Participant

    Thank you for your help the solution you gave me to work. But I have another concern. I can’t change the data of my server from the scheduler. Here is the code I used to do it:

    myAppointmentChange(item: any): void {
    let appointment = item.args.appointment;

    const singleEvent: CalendarInterface = {
    event: null,
    locationId: this.locality,
    startdate: null,
    enddate: null,
    month: null,
    year: null,
    };
    singleEvent.id = appointment.originalData.id;
    singleEvent.event = appointment.subject;
    singleEvent.startdate = appointment.originalData.start;
    singleEvent.enddate = appointment.originalData.end;
    singleEvent.month = this.date.month();
    singleEvent.year = this.date.year();
    this.calService.update(singleEvent).subscribe(
    (data) => {
    this.openSnackBar(“L’évènement a bien été mis à jour.”);
    console.log(data);
    },
    (error) => {
    console.log(error);
    },
    );
    }

    the id I get is of type string and does not match the one in my server which is of type number. What to do please?

    I have looked at similar posts to this one but unfortunately I have not found a solution to my problem.


    KevinMbitkebeyo
    Participant

    thanks

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