Custom data model to show in Template

Hi, is it possible to use templates to customize cells with own data model? Following this question...


https://www.syncfusion.com/forums/169875/use-scheduler-with-own-custom-model-class


Something like 

....

<Template>

@ {
       var data = context as BookingsData;
      <div>
             <span>@data.CheckOutTime</span>
    </div>
.....

}

I tried this, but nothing shows. How do I specify StartTime and EndTime as custom properties in templates in order to show the data?

Thanks for you help :)



1 Reply

VD Vinitha Devi Murugan Syncfusion Team August 30, 2022 12:38 PM UTC

Dear Customer,


Greetings from Syncfusion Support.


We have validated your requirement “is it possible to use templates to customize cells with own data model” at our end and we suspect that your requirement is to customize the event display with template option with own data model. To achieve your requirement we suggest you to use below highlighted code. Also, we have prepared sample for your reference and same can be available in attachment.



<ScheduleEventSettings DataSource="@DataSource">

        <ChildContent>

            <ScheduleField Id="TravelId">

                <FieldSubject Name="TravelSummary"></FieldSubject>

                <FieldLocation Name="Source"></FieldLocation>

                <FieldDescription Name="Comments"></FieldDescription>

                <FieldIsAllDay Name="FullDay"></FieldIsAllDay>

                <FieldStartTime Name="CheckInTime"></FieldStartTime>

                <FieldEndTime Name="CheckOutTime"></FieldEndTime>

                <FieldStartTimezone Name="Origin"></FieldStartTimezone>

                <FieldEndTimezone Name="Destination"></FieldEndTimezone>

            </ScheduleField>

        </ChildContent>

           <Template>

            <div>Subject: @((context as BookingsData).TravelSummary)</div>

            <div>StartTime: @((context as BookingsData).CheckInTime)</div>

            <div>EndTime:  @((context as BookingsData).CheckOutTime)</div>

        </Template>

    </ScheduleEventSettings>


Kindly try with the above sample and get back to us if you need any further assistance.


Regards,

Vinitha


Attachment: Blazorschedulecustomefieldnames_f207e4ae.zip

Loader.
Up arrow icon