I want to get events with same id....?
Coding:
import React, {useEffect, useState} from 'react';
import "../Admin";
import profile from "../images/smrft.jpg";
import NavbarComp from "../Components/NavbarComp";
import { Navbar, Nav } from "react-bootstrap";
import { useNavigate } from "react-router-dom";
import {BrowserRouter as Router,Link,useParams} from "react-router-dom";
import Viewemp from "./Viewemp";
import "./AdminCalendar.css";
import {DayPilot, DayPilotScheduler} from "daypilot-pro-react";
function Admincalendar() {
const params = useParams();
const id = params.id;
let [events, setEvents] = useState("");
const timesheetRef = React.createRef();
function timesheet() {
return timesheetRef.current.control;
}
events = {
locale: "en-us",
onBeforeRowHeaderRender: (args) => {
args.row.horizontalAlignment = "center";
},
crosshairType: "Header",
timeHeaders: [{"groupBy":"Hour"},{"groupBy":"Cell","format":"mm"}],
scale: "CellDuration",
cellDuration: 15,
viewType: "Days",
startDate: DayPilot.Date.today().firstDayOfMonth(),
days: DayPilot.Date.today().daysInMonth(),
showNonBusiness: true,
businessWeekends: false,
floatingEvents: true,
eventHeight: 30,
groupConcurrentEvents: false,
eventStackingLineHeight: 100,
allowEventOverlap: true,
allowAllEventbyId: true,
allowAllEvent: true,
timeRangeSelectedHandling: "Enabled",
}
const modal = {
id: id
};
useEffect(() => {(async () => {
const {data: result} = await DayPilot.Http.post("http://127.0.0.1:7000/attendance/EmpcalendarId",modal);
console.log("Data:",result);
timesheet().update({events: result});
})();}, []);
return (
<div>
<div>
<style>{"body { background-color: rgb(255, 255, 255); }"}</style>
<div className="main"></div>
<div className="logo">
<img src={profile} className="smrft_logo" alt="logo" />
</div>
</div>
<Navbar
style={{ width: "500px", marginLeft: "500px", marginTop: "-90px" }}
>
<Navbar.Toggle aria-controls="navbarScroll" />
<Navbar.Collapse id="navbarScroll">
<Nav
className="mr-auto my-2 my-lg-0"
style={{ maxHeight: "200px" }}
navbarScroll
>
<Nav.Link as={Link} to="/">
<div style={{ color: "green", fontFamily: "cursive" }}>Home</div>
</Nav.Link>
<Nav.Link as={Link} to="/Admin/Viewemp">
<div style={{ color: "green", fontFamily: "cursive" }}>
Employee Details
</div>
</Nav.Link>
</Nav>
</Navbar.Collapse>
</Navbar>
<br/>
<br/>
<div>
<DayPilotScheduler
{...events}
ref={timesheetRef}
/>
</div>
</div>
);
}
export default Admincalendar;
The above code has the event with same id which was not allowing .It shows Duplicate event IDs are not allowed: _103. Is there any Inbuilt function to access events with same id or How can I add events with same id..