3

When I hover over a particular cell value, the hover value is same as the cell value. Can I change the hover text different from the cell value?

Thanks

DG3
  • 5,070
  • 17
  • 49
  • 61

4 Answers4

5

You can use cellattr attribute in the colModel for a column to set custom tooltip. For example

cellattr: function () { return ' title="my custom fixed tooltip for the column"'; }
Arun Pratap Singh
  • 3,428
  • 30
  • 23
1

This can achieve by 2 steps

  1. You can simply disable the default tool tip by setting title:false
  2. write a global function and attached as a formatter in colModel

    var changeTitle = function(cellVal, options, rowObject){<br/>
        return  "&lt;div title='This is the cell value " + cellVal + "'>" + cellVal + "&lt;/div>";<br/>
    }
    
    colModel:[
    {...},<br/>
     {name:'priorityFlag', index:'priorityFlag', width:40, align:"center", formatter:   changeTitle },<br/>
    {...}]
    

There you go!...

Brant Olsen
  • 5,628
  • 5
  • 36
  • 53
w.Bala
  • 129
  • 3
1

In general the tooltip is the title attribute of the <td> elements. You can use setCell method to change the tooltip (see this). In more complex situations you can use jQuery.attr (see here) or you a tooltip plugin (see here).

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • This is what I am actually doing. I have values coming from database. One of the column's value is very long. So on display I want to show only 30 characters, and on hovering, I want to display all characters. Is this possible? – DG3 Jan 20 '11 at 17:06
  • 2
    @user508518: If you set the column width so, that 30 charachters will be seen, you will have the same effect. The user will see first 30 characters in the cell and on hovering full text will be displayed. If you want truncate the text of the cell you can use `setCell` to change the text without changing of the tooltip. – Oleg Jan 20 '11 at 17:52
0
  • You can right click title
  • Learn a column ID name ex:PersonelGrid_DefViewMainPage
  • Set you after grid load this code..

    $("#PersonelGrid_DefViewMainPage").attr("title", "This is my Title.");

it's work..

Nick
  • 138,499
  • 22
  • 57
  • 95