BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi
Is it possible to delete several selected events in one click? Does it work to select multiple items?
Please note, that getSelectedElements array is empty:
var scheduleObj = document.querySelector(".e-schedule").ej2_instances[0];
var selectedCells = scheduleObj.getSelectedElements();
ver. 20.4.50
Hi Lukasz,
You can delete multiple events in one click by holding down the ctrl key and selecting the appointments you want to delete, then releasing the Ctrl key and pressing the delete key. The delete confirmation popup will be opened clicking the delete button on the confirmation popup will delete all the selected events.
Regards,
Swathi Ravi
Dear Swathi,
Your solution works, but I need a solution in which I will programmatically take a list of selected events and perform an action, for example, through a button in the menu.
Lukasz,
You can delete the selected events programmatically by using the eventClick event and getEventDetails, deleteEvent methods, as shown in the below snippet.
API:
https://ej2.syncfusion.com/javascript/documentation/api/schedule/#deleteevent
https://ej2.syncfusion.com/javascript/documentation/api/schedule/#geteventdetails
[index.cshtml]
<div class="col-lg-9 control-section"> <ejs-schedule id="schedule" height="550" selectedDate="new DateTime(2023, 3, 15)" eventClick="onEventClick"> </ejs-schedule> </div> <button onClick=onButtonClick()> Delete </button>
<script type="text/javascript"> var slots = []; var deleteSlots = [];
function onEventClick(args) { slots = [].slice.call(document.querySelectorAll('.e-appointment-border')); //here get all selected elements }
function onButtonClick() { var scheduleObj = document.querySelector('.e-schedule').ej2_instances[0]; for (var i = 0; i < slots.length; i++) { deleteSlots.push(scheduleObj.getEventDetails(slots[i])); // get the events details of selected elements. } scheduleObj.deleteEvent(deleteSlots); // delete the selected events. } </script> |