How to disable "Add/Edit / Delete"

Hi I am using the Schedule and I would like to disable adding new events, as well as editing and deleting.

My code.
<ejs-schedule (actionComplete)="onActionComplete($event)" #scheduleObj locale="pt" width='100%' cssClass='timeline-resource-grouping' height='600px'
[selectedDate]="selectedDate"
[group]="group" [eventSettings]="eventSettings">
<e-resources>
<e-resource field='obraDataSourceId' title='Choose Project' [dataSource]='obrastDataSource'
[allowMultiple]='allowMultiple' name='Obras'
textField='text' idField='id' colorField='color'>
</e-resource>
<e-resource field='idFuncionario' title='Category' [dataSource]='funcionariosDataSource' [allowMultiple]='allowMultiple'
name='Funcionarios'
textField='text' idField='idFuncionario' groupIDField='groupObraDataSourceId' colorField='color'>
</e-resource>
</e-resources>
<e-views>
<e-view option="TimelineDay"></e-view>
<e-view option="TimelineWeek"></e-view>
<e-view option="TimelineWorkWeek"></e-view>
<e-view option="TimelineMonth"></e-view>
<e-view option="Agenda"></e-view>
</e-views>
</ejs-schedule>

3 Replies

VM Vengatesh Maniraj Syncfusion Team February 27, 2020 05:25 AM UTC

Hi Vinícius, 

Greetings from Syncfusion Support. 

We could disable the add, edit and delete action in our Schedule by making use of allowAdding, allowEditing and allowDeleting fields within the eventSetting property like below code, 

public eventSettings: EventSettingsModel = { 
      allowAdding: false, 
      allowEditing: false, 
      allowDeleting: false, 
      dataSource: <Object[]>extend([], resourceData.concat(timelineResourceData), null, true) 
    }; 


Kindly check the above sample and get back to us for further assistance. 

Regards, 
Vengatesh 



VI Vinícius replied to Vengatesh Maniraj March 6, 2020 01:37 PM UTC

Hi Vinícius, 

Greetings from Syncfusion Support. 

We could disable the add, edit and delete action in our Schedule by making use of allowAdding, allowEditing and allowDeleting fields within the eventSetting property like below code, 

public eventSettings: EventSettingsModel = { 
      allowAdding: false, 
      allowEditing: false, 
      allowDeleting: false, 
      dataSource: <Object[]>extend([], resourceData.concat(timelineResourceData), null, true) 
    }; 


Kindly check the above sample and get back to us for further assistance. 

Regards, 
Vengatesh 


Thank you, work fine.
Now, how can I handle click event of add button




VM Vengatesh Maniraj Syncfusion Team March 9, 2020 05:13 AM UTC

Hi Vinícius, 

Thanks for the update. 

We are happy that your previous requirement has fulfilled. 

And in mobile mode, we have prevent the click event in source end when we disabled the allowAdding property. If we want to add click event for this add button, we could achieve by making use of actionComplete event like below, 

public onActionComplete(args: ActionEventArgs) { 
    if (args.requestType === "toolBarItemRendered") { 
      EventHandler.add(document.querySelector(".e-add"), "click", this.addClick.bind(this)); 
    } 
  } 

And the same we have prepared the below sample. 


In the above sample, we have added the custom event for the add button. Kindly check the above sample and get back to us if you would require any further assistance. 

Regards, 
Vengatesh 


Loader.
Up arrow icon