Add Custom Data To Kendo UI Calendar For Tooltip

Cef

I have the following calendar and tooltip:

$("#achCalendar").kendoCalendar({
    dates: events,
    navigate: MonthNavigate,
    change: DateChange,
    value: cur,
    month: {
        // template for dates in month view
        content: "# if ($.inArray(data.date.formatMMDDYYYY(), events) != -1) { data.title('check check'); #" +
                        "<div class='" +
                    "# if (data.date < currentDate) { #" +
                        "past" +
                    "# } else if (data.date.formatMMDDYYYY() == currentDate.formatMMDDYYYY()) { #" +
                        "current" +
                    "# } else { #" +
                        "future" +
                    "# } #" +
                "'>#= data.value #</div>" +
            "# } else { #" +
            "#= data.value #" +
            "# } #"
    },
    footer: "Today - #=kendo.toString(data, 'd') #"
});

var tooltip = $("#achCalendar").kendoTooltip({
    filter: "td .k-link",
    width: 120,
    position: "top",
    content:  function(e) {
        var target = e.target; // the element for which the tooltip is shown
        return target.data("title"); // set the element text as content of the tooltip
    }
}).data("kendoTooltip");

What I would like to do is for each day add some custom text that will appear in the tooltip. I was thinking to update the title for each day but that does not seem to be working, at least the way I am attempting to do it.

Any ideas? Thanks in advance.

Cef

Here is what Telerik responded with:

$(document).ready(function() {

      $("#achCalendar").kendoCalendar({
        dates: events,         
        month: {
          // template for dates in month view
          content: "# if ($.inArray(+data.date, events) != -1) { #" +
          "<div data-tooltip='#=kendo.toString(data.date, \"d\")#' class='" +
            "# if (data.date < currentDate) { #" +
            "past" +
            "# } else if (data.date == currentDate) { #" +
            "current" +
            "# } else { #" +
            "future" +
            "# } #" +
            "'>#= data.value #</div>" +
            "# } else { #" +
            // wrap the text in a div in order to add the data-tooltip
            "<div data-tooltip='#=kendo.toString(data.date, \"d\")#'>#= data.value #</div>" +
            "# } #"
        },
        footer: "Today - #=kendo.toString(data, 'd') #"
      });

      $("#achCalendar").find(".k-state-selected").removeClass("k-state-selected");

      var tooltip = $("#achCalendar").kendoTooltip({
        filter: "td .k-link>div", // target the inner element to which the data-tooltip is added
        width: 120,
        position: "top",
        content:  function(e) {
          var target = e.target;                            
          return target.data("tooltip"); 
        }
      }).data("kendoTooltip");
    });

And here is the Dojo example

http://dojo.telerik.com/@rkonstantinov/iwuNU

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

JQuery UI Tooltip with data attributes

From Dev

kendo ui tooltip for custom command

From Dev

Kendo UI Tooltip remove/destroy?

From Dev

Kendo UI Autocomplete custom binding

From Dev

Kendo UI Tooltip on show, access target?

From Dev

Positioning issue with kendo ui tooltip inside a grid

From Dev

Kendo UI - Upload Button - Custom

From Dev

How to custom tooltip such as contains some button in grid's cell tooltip in Kendo UI MVC?

From Dev

Kendo UI - Tooltip in a grid

From Dev

Getting list of dates in view for Kendo UI calendar

From Dev

Add custom data on tooltip of Highcharts donut graph

From Dev

display value of series and y axis data together in tooltip template kendo UI

From Dev

Custom command in Kendo UI Grid

From Dev

Add tooltip to Excel Add-in Custom Ribbon UI XML

From Dev

How to use kendo chart data in Tooltip Template?

From Dev

Add custom command to Kendo UI dynamic datasource / grid

From Dev

Kendo UI Tooltip remove/destroy?

From Dev

How to custom tooltip such as contains some button in grid's cell tooltip in Kendo UI MVC?

From Dev

Kendo UI - Tooltip in a grid

From Dev

Kendo UI - Displaying images in a tooltip

From Dev

Developing custom kendo ui widget

From Dev

Kendo UI Calendar Multiselection

From Dev

Custom Serial Number in Kendo UI

From Dev

Kendo UI chart tooltip and redraw

From Dev

Kendo Grid UI with custom function

From Dev

Angular 2 - Kendo UI Calendar not rendering correctly

From Dev

kendo chart tooltip custom position on plot area

From Dev

How to add a custom tooltip to a JtextField?

From Dev

Custom template in kendo-ui grid column with inconsistent data type

Related Related

HotTag

Archive