We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

refreshEvents closes the popup?

Hi,

I'm seeing some odd behaviour. In my application, I have some code to colour events when they have been clicked on, by setting a property on them, and then using u this in onEventRendered to set the colour. In order to make onEventRendered fire, I'm calling refreshEvents().

The problem is that a lot of the time, the refreshEvents() call closes the popup as soon as it appears, which is not the desired behaviour. Is there a way to either:
 - Re-render that specific event without calling refreshEvents()
 - Make refreshEvents() not close the popup?

Thanks,
-Chris

3 Replies

VD Vinitha Devi Murugan Syncfusion Team July 16, 2019 01:27 PM UTC

Hi Chris, 
 
Greetings from Syncfusion. 
 
Please share the following details. 
 
  1. Where you have set the color code to the events.
  2. If have set the color code and call the refreshEvents within eventClick event, share the code snippet you have tried.
  3. Share the detail of popup, like you are mentioning quick popup or detailed event window.
 
Kindly share the requested details so that we could check the problem and provide the solution at earliest. 
 
Regards, 
M.Vinitha devi. 



CC Chris Cunningham July 16, 2019 08:10 PM UTC

Hi,

My eventRendered code colours events based on whether they're part of a separate "selectedJobMasterIds" set (driven from other parts of the UI), and  looks like:

  onEventRendered(args: EventRenderedArgs): void {
    let jobEvent: CalendarEvent = <CalendarEvent><unknown>args.data;
    var colour = "green";
    if (jobEvent.job.isClosed) {
      colour = "darkgrey";
    } else if (this.selectedJobMasterIds.has(jobEvent.jobMasterId)) {
      colour = "#FF6A00";
    }
    args.element.style.backgroundColor = colour;
  }


My eventClick does the following to add the event to the external selected list ("selectedJobMasterIds"), and then re-render everything:

        this.selectedJobMasterIds.add(jobEvent.jobMasterId);
        this.scheduleObj.refreshEvents();

The popup is the quick popup. It appears extremely briefly, before disappearing. I believe this is due to the refreshEvents() call.


KK Karthigeyan Krishnamurthi Syncfusion Team July 17, 2019 08:42 AM UTC

Hi Chris 
 
Thanks for the update. 
 
We suspect that your requirement is to change the event color when it is clicked. When have prepared the below sample to customize the event color using eventClick event based on Status field. 
 
onEventClick (args: EventClickArgs): void { 
    let obj = (args.event as any).Status; 
    if (obj === "Inprogress") { 
      (args.element as HTMLElement).style.background = "gray"; 
    } else if (obj === "Closed") { 
      (args.element as HTMLElement).style.background = "green"; 
    } else if (obj === "Open") { 
     (args.element as HTMLElement).style.background = "brown"; 
    } 
  } 
 
Regards, 
Karthi 


Loader.
Live Chat Icon For mobile
Up arrow icon