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

Tooltip does not hide with empty value

1 Answer 861 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Shahar
Top achievements
Rank 1
Shahar asked on 24 Jun 2013, 08:01 AM
Hey
I'm having problems hiding the tooltip in web grid when thet value of the cell is null/empty string.
I used templates to add the content.
I'm using asp.net mvc razor.
here is the example code :
        chtml file:
        @(Html.Kendo().Tooltip()
        .For("#FlatReportGrid")
        .Position(TooltipPosition.Center)
        .Filter("td")
        .ContentTemplateId("gridtooltipTemplate")
        //.Events(events => events.Show("TooltipOnShow"))
        )

<script type="text/x-kendo-template" id="gridtooltipTemplate">   
     <div id="ErrorReportGridTooltip" class="TooltipStyle">
        #=target.text()#
     </div>  
</script>

Css file:
<style>
   .TooltipStyle {
       font-family:Arial, Helvetica, sans-serif;
       font-size:14px;
       white-space:pre-wrap;
       overflow:visible;
       max-width: 250px;
   }
</style>

I'm finding it hard to remove the tooltip whne getting empty valuse.
I tried to set a differnt css class for my tooltip ErrorReportGridTooltip div but the frame(border and background) do not disappear.
Any ideas will be much appriciated

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 24 Jun 2013, 03:05 PM
Hello Shachar,

For this kind of functionality I would suggest you two different approaches:

  1. Use the :empty selector to create a "whitelist" for which cells the Tooltip box will be displayed. You can use something like this .Filter("td:not(:empty))". However please keep in mind that this is a CSS3 selector and it is only supported in IE9+, Firefox 3+, Safari 3.1+, Chrome 2.0+, Opera 9.5+ etc.
  2. Another approach is to implement a functionality that will check whether the cell in the grid is empty and if its not empty to add a custom class to it. After that you will be able to use .Filter(".notEmpty"), so again you can filter the cells for which the Tooltip won't be displayed.
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ToolTip
Asked by
Shahar
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or