Our pure JavaScript Scheduler component


Post by KAB »

Hi

Version 1.2.1
I cannot figure out how to control the attributes that are sent on the EventModel via CrudManager and sync.
The flag has no effect. Am I using it correctly?

edit: the following values are sent to the server e.g.: But how can I control which attributes are sent?
{u'startDate': u'2019-02-17T05:00:00.000Z', u'endDate': u'2019-02-26T05:00:00.000Z', u'name': u'Hans Peter', u'resourceId': 32, u'eventColor': u'orange', u'duration': 9, u'partner_id': 9, u'id': 48, u'reservation_id': 46}
 class Reservation extends bryntum.scheduler.EventModel {
        constructor(reservation) {
            super(reservation);

            var draggable = true;
            var color = "yellow";
            var resizeable = true;

            switch (reservation.reservation_state) {
                case "draft":
                    color = "orange";
                    draggable = true;
                    resizeable = true;
                    break;
                case "confirm":
                    color = "red";
                    draggable = true;
                    resizeable = false;
                    break;
                case "done":
                    color = "green";
                    draggable = false;
                    resizeable = false;
                    break;
                default:
                    color = "green";
                    draggable = false;
                    resizeable = false;
            }

            this.id = reservation.id;
            this.name = reservation.partner_id[1];
            this.partner_id = reservation.partner_id[0];
            this.thumbnail = reservation.partner_id_image_small;
            this.resourceId = reservation.room_numbers_ids[0];
            this.categ_id = reservation.room_id[0];
            this.startDate = time.str_to_date(reservation.checkin);
            this.endDate =  time.str_to_date(reservation.checkout);
            this.eventColor = color;
            this.draggable = draggable;
            this.resizable = resizeable;
            this.reservation_state = reservation.reservation_state;
            this.reservation_id = reservation.reservation_id[0];
            this.nights = reservation.stay_days;
            this.reservation_hotel_policy = reservation.reservation_hotel_policy;
            this.reservation_amount_total = reservation.reservation_amount_total;
        };

        static get fields() {
            [
                // `Id` and `Name` fields are already provided by the superclass
                {name: 'resourceId', type: 'integer', persist: true},
                {name: 'partner_id', type: 'integer', persist: false},
                {name: 'startDate', type: 'date', persist: true},
                {name: 'endDate', type: 'date', persist: true},
                {name: 'categ_id', type: 'integer', persist: true},
                {name: 'eventColor', type: 'string', persist: false},
                {name: 'draggable', type: 'boolean', persist: false},
                {name: 'resizable', type: 'boolean', persist: false},
                {name: 'durationUnit', type: 'string', persist: false},
                {name: 'thumbnail', type: 'string', persist: false},
                {name: 'nights', type: 'integer', persist: false},

            ];
        }


    }

Post by mats »

We could not reproduce this issue. To assist you with your question, please provide more details including a runnable test case (as described in our support guidelines).

To get the fastest possible support, provide a simple test case based on our standard examples.

Post by KAB »

Ok you can close it. The return statement is missing on
static get fields()
:oops:

Post Reply