Set events to read only from server side data

The issue here , I use class to build the data and return that data in the schedule.load(url,“json”)

To use the readonly on the server side, the property cannot be readonly. That is a reserved syntax.

How can I create a class that can return the readonly property?

    public TimeLineEvent()
    {

    }
    public TimeLineEvent(Code.Data.VP.Job job)
    {
        id = job.KeyID;
        text = job.JobId;
        start_date = job.CalculatedStartDate()?.ToString("yyyy-MM-dd HH:mm");
        end_date = job.CalculatedEndDate()?.ToString("yyyy-MM-dd HH:mm");
        section_id = job.CrewId ?? "null";
        @readonly = true;
    }
    public long id { get; set; }

    public string text { get; set; }

    public string start_date { get; set; }

    public string end_date { get; set; }

    public string section_id { get; set; }

    public bool @readonly { get; set; }

Hello @glenlewis09 ,

Probably the easiest way in your case is to use some custom property, like customReadOnly, and use the onEventLoading event:
https://docs.dhtmlx.com/scheduler/api__scheduler_oneventloading_event.html

To make events with this property readonly:

scheduler.attachEvent("onEventLoading", function(ev){
if(ev.customReadOnly){
    scheduler.getEvent(id).readonly = true;
    return true;
}
});

So events that came from the server-side will become read-only just on the client-side.

Another approach(more complicated) is to use some custom property, like customReadOnly, and just block any iterations with such events like follows:

scheduler.attachEvent("onBeforeLightbox", function (id){
  var ev = scheduler.getEvent(id);
  if(ev.customReadOnly){
      return false;
  }
  return true;

}); 
scheduler.attachEvent("onBeforeDrag", function (id, mode, e){
  if(mode != "create"){
    var ev = scheduler.getEvent(id);
    if(ev.customReadOnly){
      return false;
    }
  }
  return true;

});

Here is the full list of scheduled events:
https://docs.dhtmlx.com/scheduler/api__refs__scheduler_events.html

Kind regards,