Get selected event in Perspective Equipment Schedule component

Title says most of it… The Perspective Equipment Schedule component has four component events:
image

I want to add functionality to this component by opening a dock or popup and allowing a user to modify details of the scheduled event, but I found that there isn’t an event that would do this! The closest thing I can find is to add an onClick mouse event and then return the selectedEvent object, which returns an itemId and eventId. The problem is that the onClick event would also fire even when no event is selected because it is set on the entire component, not just on the events.

Another thing I noticed is the examples for the equipment schedule in the documentation have scripts for onAddEvent, onMoveEvent, onResizeEvent, and onDeleteEvent - all of those scripts besides the onAddEvent work in a similar way: an event fires (with an eventId and itemId) and then to actually change the event, you need to loop through the entire scheduledEvents list every time this action happens. I haven’t tested it that extensively, but doesn’t that seem like it would create performance issues when there are many events?

Hi @YF129701,

I’ll go ahead and file a feature request ticket for the onEventClicked and keep you updated on the status.

The last one is a bit tricky to answer with complete certainty. It depends on how many events a user is going to bring in. If it’s on the scale of 100s or 1000s then I don’t think it’ll create any noticeable performance issues regarding those events specifically.

If you are seeing performance issues, there are a few things you can do such as limiting the amount of events to bring in based on the visible time frame or perhaps you can create a separate object that maps some itemId eventId combination to the index of the events array (you would have to manually adjust keep this in sync). There could be some kind of a feature improvement to have these functions return their index from the scheduled events prop array, but I won’t make any promises there.

Thank you for doing that. Do you know approximately when that would be available? I’m going to be using this component in my next few projects.

I’ll go ahead and escalate the issue since there are others requesting for this same feature. Can’t make any promises but I’ll see what I can do.

3 Likes

Another weird behavior I’ve seen is that if I click on an event and not move it, it fires onMoveEvent 3 times for every one time I click on an event

I could almost have gotten away with using that event in the meantime except that it fires off more than once (even though the event wasn’t even moved)

Yea that’s strange. Let me play around with it and I’ll go ahead and file a bug ticket for this.

1 Like

Were you able to see why the move event was firing 3 times? Also do you have an approximate timeline when the click event might be rolled out? I have 3 projects in the next few months that will use this component, so it would be really nice to see that feature in the near future.

Hi @YF129701,

I haven’t had the time to poke around yet, I have some other things I need to finish before picking it up. As for the event clicked feature, I’ve escalated this up and we should be working on this starting soon, hopefully within the next few days.

2 Likes

Another potential bug fix for this would be to allow users to use an embedded view instead of the default event markers. That would allow us to define the click events from within the embedded view. This might be a better solution, I just don’t know what development would look like for these features. The idea also came from @nader.chinichian from the Equipment Schedule component announcement forum post.

Not sure how helpful this would be to your situation, but how I was able to get around this issue was add a change script to selectedEvent.itemId

1 Like