Can't get event ID in Calendar

Previously, I used an expression like $event.id to access the event id when Event clicked - and in a NodeJS project it works.

But when I try to do the same action in a PHP project, there is an empty value.

In addition to calling $event.lesson_id, I also tried the option of converting to a number $event.lesson_id.toNumber() - but this also does not work - return NaN.

Are you on the beta or stable extensions channel?

last stable

Open your browser dev tools and in the console enter dmx.app.data hit enter. Then expand the tree under the calendar and see if you can see the id of the events as on my screenshots:

I don’t know why, but I can’t enter anything directly into the console - the input there is simply inactive

I am referring to the dev tools in your browser.

Something doesn’t look very similar to what you have…

It’s different as your page structure is different. Find your calendar there and check the events :slight_smile:

Well, it looks like the id itself is there, but the $event.id expression still doesn’t return anything

Please paste the code generated for the click event.

<dmx-calendar id="calendar_lessons" views="dayGridMonth,dayGridWeek,dayGridDay" view="dayGridMonth" locale="ru" aspect-ratio="1.7" theme="bootstrap" dmx-on:eventclick="run({run:{outputType:'text',action:`get_lesson.load({lesson_id: $event.id},true)`}})">
                                                <dmx-calendar-source id="source_lessons" event-id="id" event-start="lesson_date_time.toISODate()" event-end="lesson_date_time.addMinutes(90).toISODate()" background-color="rgba(0, 183, 230, 0.51)" text-color="#000" event-title="lesson_date_time.formatDate('HH:mm')+' N.'+lesson_number+' / '+stream_name" dmx-bind:events="get_lessons.data.query_lessons">
                                                    <dmx-calendar-event id="event_el"></dmx-calendar-event>
                                                </dmx-calendar-source>
                                            </dmx-calendar>

and it seems the ID’s is there inside

Why are you using an inline flow here? Why not call the server action directly in the onclick event? Flows are used for complex multi steps actions, for a single action you can just call it directly.

<dmx-calendar id="calendar_lessons" views="dayGridMonth,dayGridWeek,dayGridDay" view="dayGridMonth" locale="ru" aspect-ratio="1.7" theme="bootstrap" dmx-on:eventclick="run({serverConnect:{name:'sc',outputType:'object',url:'/dmxConnect/api/get_lesson.php',site:'Guitar',params:{lesson_id:`$event.id`}}})">
                                                <dmx-calendar-source id="source_lessons" event-id="id" event-start="lesson_date_time.toISODate()" event-end="lesson_date_time.addMinutes(90).toISODate()" background-color="rgba(0, 183, 230, 0.51)" text-color="#000" event-title="lesson_date_time.formatDate('HH:mm')+' N.'+lesson_number+' / '+stream_name" dmx-bind:events="get_lessons.data.query_lessons">
                                                    <dmx-calendar-event id="event"></dmx-calendar-event>
                                                </dmx-calendar-source>
                                            </dmx-calendar>

I tryed - but never changed

Well remove the flow from the onclick event first!
Then use the action picker button:

Done that method - result the same

<dmx-calendar id="calendar_lessons" views="dayGridMonth,dayGridWeek,dayGridDay" view="dayGridMonth" locale="ru" aspect-ratio="1.7" theme="bootstrap" dmx-on:eventclick="get_lesson.load({lesson_id: $event.id},true)">

I think you are picking some wrong value. Your expression is not correct: $event.id should be $event.event.id:

Yes you are right. Now it works, thanks!