Our powerful JS Calendar component


Post by SHQK »

I'm using "beforeDragMoveEnd" and "beforeDragResizeEnd" to update event,
When I using "beforeDragResizeEnd", I can easily get the Id of the event I am resizing by using the realEventId property in the eventRecord,
But this property is not present in the eventRecord of the "beforeDragMoveEnd" event, so I can't get the Id of the event I'm moving and update it.
Attached file is the comparison when i use console.log of "beforeDragMoveEnd" and "beforeDragResizeEnd"

Attachments
DRAGANDMOVE.PNG
DRAGANDMOVE.PNG (49.11 KiB) Viewed 95 times

Post by mats »

You can just read that off the record like this:

record.realEventId

Assuming you have added this field to your model https://bryntum.com/docs/calendar/#Core/data/Model#property-fields

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by SHQK »

mats wrote:
Sun Jun 06, 2021 9:18 pm

You can just read that off the record like this:

record.realEventId

Assuming you have added this field to your model https://bryntum.com/docs/calendar/#Core/data/Model#property-fields

Hi sir,
There is no "record" parameter in "beforeDragMoveEnd", so how can I use it,
And I dont understand what field i need to add,
Please describe more detail,
Your answer is too general and not clear

Attachments
abc.PNG
abc.PNG (52.24 KiB) Viewed 88 times

Post by mats »

Yes I meant the eventRecord param:

Open https://bryntum.com/examples/calendar/basic/
and run on the console, then drag an event and you see it logging the id of the eventRecord

calendar.on('beforedragmoveend', ({ eventRecord }) => console.log(eventRecord.id))

Here's the docs for creating your own event model and adding a new field to it: https://bryntum.com/docs/calendar/#Scheduler/model/EventModel#subclassing-the-event-model-class

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by SHQK »

The first, please ignore about create my own event model and adding new field, we will discuss about it in another topic
The second, please reply me in this topic: viewtopic.php?f=54&t=17713
And about this topic:
Im download your filtering demo and apply example called "confirmation-dialogs"
So I run the console with "beforeDragResizeEnd" like this

        beforeDragResizeEnd : async({ eventRecord }) => {
          console.log("beforeDragResizeEnd eventRecord: ", eventRecord.data.realEventId)
        }

And this is result:

beforeDragResizeEnd eventRecord:  5

Then I run the console with "beforeDragMoveEnd" follow your guide

        beforeDragMoveEnd : async({ eventRecord }) => {
          console.log("beforeDragMoveEnd eventRecord: ", eventRecord.id)
        }

And this is result

beforeDragMoveEnd eventRecord:  _generated_0x2bd9c21

It's too different you can see,
So how can I get value "5" of realEventId in "beforeDragMoveEnd" with your filtering demo
Please guide me


Post by mats »

First, avoid using 'data' of the eventRecord - pretend it's not there (it's a private member). Instead, define your own model and add your fields to it as per the docs I gave you above.

What is 'realEventId' in your app? If it's the id of your event, either rename this field in the backend to serve it to client side as 'id' or map your EventModel to use it as the id field (what you see when logging id is a generated id used until you save it in the server).

Here's docs for https://bryntum.com/docs/scheduler/#Core/data/Model#property-idField-static

YourEventModel.idField = 'realEventId'

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by SHQK »

mats wrote:
Mon Jun 07, 2021 11:53 am

First, avoid using 'data' of the eventRecord - pretend it's not there (it's a private member). Instead, define your own model and add your fields to it as per the docs I gave you above.

What is 'realEventId' in your app? If it's the id of your event, either rename this field in the backend to serve it to client side as 'id' or map your EventModel to use it as the id field (what you see when logging id is a generated id used until you save it in the server).

Here's docs for https://bryntum.com/docs/scheduler/#Core/data/Model#property-idField-static

YourEventModel.idField = 'realEventId'

Thanks guy,
Thank you for your patience


Post by mats »

Any time! :)

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post Reply