Reputation: 1353
How can we add a tooltip on a column level. What I mean by column level is that all the rows( belonging to the same column) should have the same tooltip content.
For eg, Consider a column called "Manager Name". All rows of that column should display tooltip as "Click here to see manager details".
Can this be done on colModel level. I am aware of custom formatters, where I can add title to "cellValue". But I am really not looking for this as I am already using a complicated custom formatter.
I hope there is a straight forward way to achieve this.
Upvotes: 3
Views: 5225
Reputation: 9195
To use this functionality with the asp.net library of jqGrid, add this to your column. I can't find this documented well anywhere else online...
<Formatter>
<trirand:CustomFormatter SetAttributesFunction="clientSideFunctionName" />
</Formatter>
Upvotes: 0
Reputation: 221997
You can use
cellattr: function () { return ' title="the tooltip text"'; }
I use such kind of tooltips personally on every column having formatter: "checkbox"
. It is very practical if one have many columns with chechboxes and look at some row in the middle of the grid. In the case it's frequently difficult to determine in which column is the checkbox. In the case the above tooltips are very helpful.
Like you see the cellattr
is a function and which has some optional parameters: rowId
, cellValue
, rawObject
etc (see the documentation). It allows you to create really flexible tooltip texts.
One more remark. The advantage of cellattr
compared to the custom formatters is that you can continue to use predefined formatters and set only custom attributes like title
, class
and so on. So you can set custom attribute on the columns having select
, date
, integer
, checkbox
and so on formatter.
Upvotes: 6