@(Html.EJS().Schedule("schedule") .Width("100%") .Height("550px") .DataBound("onDataBound") .Render() )
<script script type="text/javascript"> function onDataBound() { const scheduleObj = document.querySelector('.e-schedule').ej2_instances[0]; const workCells = document.querySelectorAll(".e-work-cells.e-resource-group-cells"); workCells.forEach((cell, index) => { let projectEvents = []; const timestamp = Number(cell.getAttribute('data-date')); const startDate = new Date(timestamp); const endDate = new Date(startDate); endDate.setDate(startDate.getDate() + 1); // add one day const events = scheduleObj.getEvents(startDate, endDate); const cellRoomId = scheduleObj.getResourcesByIndex(Number(cell.getAttribute("data-group-index"))).groupData.RoomId; events.forEach(event => { if (event.RoomId === cellRoomId) { projectEvents.push(event); } }); cell.innerHTML = ''; if (projectEvents.length > 0) { const circleDiv = document.createElement('div'); circleDiv.classList.add('event-circle'); cell.appendChild(circleDiv); } }); } </script>
<style> .event-circle { width: 15px; height: 15px; background-color: red; border-radius: 50%; margin: auto; } </style> |