JavaScript/jQuery Calendar - Customize Cell Appearance
For Angular, AngularJS, and Knockout apps, DevExtreme provides the dxTemplate markup component. The following code shows how to use dxTemplate to define templates for cells.
If you use jQuery alone, use DOM manipulation methods to combine the HTML markup for cells. To apply this markup, use the cellTemplate callback function as shown in the following code.
JavaScript
- $(function () {
- $("#calendarContainer").dxCalendar({
- value: new Date(),
- cellTemplate: function (cellData, cellIndex, cellElement) {
- const italic = $("<span>").css('font-style', 'italic')
- .text(cellData.text);
- const normal = $("<span>").text(cellData.text);
- return (cellIndex == 0 || cellIndex == 6) ? italic : normal;
- }
- });
- });
See Also
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.