Hello,
We would like to know how to customize the scheduler popup- we are using a react functional component with typescript. All of your samples are in class components- and none of them seem to adapt to functional components- and still work---and we are using react HOOKS---do you have a sample or can help us get this working?
Thanks
|
function App() {
let data: Object[] = extend([], (scheduleData as any), true) as Object[];
const template: string | any = (args: { [key: string]: Object }) => {
return (<div className="tooltip-wrap">
<div className={"image " + args.EventType}></div>
<div className="content-area"><div className="event-name">{args.Subject}</div>
{(args.City !== null && args.City !== undefined) ? <div className="city">{args.City}</div> : ''}
<div className="time">From : {args.StartTime.toLocaleString()}</div>
<div className="time">To :
{args.EndTime.toLocaleString()}</div>
</div></div>);
}
const renderEvent = (args: EventRenderedArgs) => {
var scheduleObj = (document.querySelector('.e-schedule') as any).ej2_instances[0];
let color = args.data.CategoryColor;
let categoryColor: string = (isNullOrUndefined(color) ? '#e3165b' : color).toString();
if (!args.element || !categoryColor) {
return;
}
if (scheduleObj.currentView === 'Agenda') {
let firstChild: HTMLElement = (isNullOrUndefined(args) ? args.element.firstChild : args.element) as HTMLElement;
firstChild.style.backgroundColor = categoryColor;
}
else {
args.element.style.backgroundColor = categoryColor;
}
}
return (
<ScheduleComponent id="schedule" selectedDate={new Date(2018, 3, 1)} eventSettings={{ dataSource: data, enableTooltip: true, tooltipTemplate: template }} eventRendered={renderEvent}>
<ViewsDirective>
<ViewDirective option='Day' />
<ViewDirective option='Week' />
<ViewDirective option='WorkWeek' />
<ViewDirective option='Month' />
</ViewsDirective>
<Inject services={[Day, Week, WorkWeek, Month, DragAndDrop, Resize]} />
</ScheduleComponent>
);
} |