DevExtreme jQuery/JS - Customize Cell Appearance

For Angular, AngularJS, and Knockout apps, DevExtreme provides a markup component called dxTemplate. The following code shows how you can use dxTemplate to define templates for cells.

If you use jQuery alone, combine the HTML markup for cells manually with jQuery DOM manipulation methods. 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) {
  • var italic = $("<span>").css('font-style', 'italic')
  • .text(cellData.text);
  • var normal = $("<span>").text(cellData.text);
  • return (cellIndex == 0 || cellIndex == 6) ? italic : normal;
  • }
  • });
  • });

In addition, you can use a 3rd-party template engine to customize widget appearance. For more information, see the 3rd-Party Template Engines article.

See Also