This is a migrated thread and some comments may be shown as answers.

Cancel Tooltip on Cell

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl Mikesell
Top achievements
Rank 1
Karl Mikesell asked on 26 Dec 2013, 09:40 PM
The tooltip works properly on Grid cells; however, some cells have no information for tooltip, but an empty tooltip container appears.  In this case is it possible to cancel the tooltip from appearing.  Trapping the onmouseenter does not work becuase this event occurs before the content event fires which has the dataItem content.

content: function(e) {
var item = e.target[0].attributes["myAttribute"].value;
var row = jQuery(e.target).closest("tr");
var dataItem = myGrid.dataItem(row);
var tooltip = dataItem[item];
  if (null == tooltip) {
  //Cancel display here???
  }
return tooltip;
}

Ideas?

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 27 Dec 2013, 10:39 AM
Hi Karl,

Basically if you do not want to show a tooltip for a particular element then that element should match the Tooltip's filter. In the current scenario I would recommend you the following approach:
  1. Use a columns.template in which you can check whether or not the dataItem has the necessary values 
  2. In case it does - wrap the display text in a div or span element with some custom class, for example "show-tooltip" 
  3. Add the "show-tooltip" to the Tooltip's filter option

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Karl Mikesell
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or