BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
When I set the date format on the Schedule control to "dd. MMM yyyy" it gets shown properly in the header datepicker but not in the timeline header. Am I missing something
Hi Thomas Pentenrieder,
You can customize the header row of timeline header rows and display formatted text on each individual header rows using the built-in template option available within the HeaderRowDirective.
Kindly check on the below demo and documentation for better understanding:
Demo: https://ej2.syncfusion.com/react/demos/#/fluent2/schedule/header-rows
Documentation: https://ej2.syncfusion.com/react/documentation/schedule/header-rows
Regards,
Ram
but why is a date format only applied partially on the schedule control. that doesn't make much sense imo.
Hi Thomas,
Based on your requirements, we recommend using the dateHeaderTemplate
to customize the date header format, as demonstrated in the code snippet below.
Please refer to the provided user guide and sample for further reference. We
encourage you to try it out.
[index.js]
import { extend, Internationalization } from '@syncfusion/ej2-base'; import * as dataSource from './datasource.json'; /** * schedule timeline resource grouping sample */ const TimelineGrouping = () => { let instance = new Internationalization(); const getDateHeaderText = (value) => { return instance.formatDate(value, { format: 'dd.MMM yyyy' }); }; const dateHeaderTemplate = (props) => { return (<div> <div>{getDateHeaderText(props.date)}</div> </div>); }; return (<div className='schedule-control-section'> <div className='col-lg-12 control-section'> <div className='control-wrapper'> <ScheduleComponent dateFormat="dd.MMM yyyy" dateHeaderTemplate={dateHeaderTemplate}> </ScheduleComponent> </div> </div> </div>); }; export default TimelineGrouping; |
DateHeaderTemplate UG: https://ej2.syncfusion.com/react/documentation/schedule/header-bar#using-date-header-template
dateHeaderTemplate api: https://ej2.syncfusion.com/react/documentation/api/schedule/#dateheadertemplate
Sample link: https://stackblitz.com/edit/react-yhv4zr-jmnj7s?file=index.js
Output screenshot:
Regards,
Vijay
Thanks, but that will also override the Month Timeline View dateheader where there's only space for the day number and not the whole date. any way to exclude this view?
return (<div className='schedule-control-section'> <div className='col-lg-12 control-section'> <div className='control-wrapper'> <ScheduleComponent cssClass='timeline-resource-grouping' width='100%' height='650px' selectedDate={new Date(2023, 0, 4)} currentView='TimelineWeek' > <ViewsDirective> <ViewDirective option='TimelineDay' dateHeaderTemplate={dateHeaderTemplate}/> <ViewDirective option='TimelineWeek' dateHeaderTemplate={dateHeaderTemplate}/> <ViewDirective option='TimelineWorkWeek' dateHeaderTemplate={dateHeaderTemplate}/> <ViewDirective option='TimelineMonth'/> <ViewDirective option='Agenda' dateHeaderTemplate={dateHeaderTemplate}/> </ViewsDirective> <Inject services={[TimelineViews, TimelineMonth, Agenda, Resize, DragAndDrop]}/> </ScheduleComponent> </div> </div> </div>); }; |
applying it on ViewDirective worked, thanks!
Hi Thomas,
You are welcome. We are glad to hear that our provided solution was worked for you. Get back to us if you need any further assistance.
Regards,
Swathi