0

I am using jqgrid and I want to have a tooltip that is a different value for each column heading (i want to put in the description in to a tooltip) for each column name. In my case I am using the treegrid but my question applies to both the treegrid and the regular jqgrid.

Is this possible? Again, I am looknig to do this for every column header (both regular and grouped header cols)

leora
  • 188,729
  • 360
  • 878
  • 1,366

2 Answers2

2

I think this answer gives the answer on your question too.

If you prefer to use more direct way as described in the answer you can just use the fact that all <th> elements of the column headers has ids which are constructed from the id of the grid, like "list" and the value of the name property of the column, like "tax", and the underscore ("_") between. So in the described above example the id of the column will be "list_tax". So you can set the tooltip just by setting of the title attribute on the corresponding <th> element:

$("#list_tax").attr("title", "my tooltip");
Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • @leora: The grouping header is just in the first `` of the `` elements having `"jqgroup"` class. You can additionally use `groupingView.sortnames[0]` to have the list of all groups. – Oleg Dec 15 '11 at 01:13
0

To add tooltip just call this methode on loadcomplete:

addToolTipForColumnheader('YourGridID');

function addToolTipForColumnheader(gridID){
    var columnNameList=$('#'+gridID)[0].p.colNames;
    for (var i = 0; i < columnNameList.length; i++){
        var columnName=$('#'+gridID)[0].p.colModel[i].name;
        $('#'+gridID+'_'+columnName).attr("title", $('#'+gridID)[0].p.colNames[i]);
    }
}  
Pang
  • 9,564
  • 146
  • 81
  • 122