ejGrid Cell tooltip
Thanks for using Syncfusion products.
Essential Grid don’t have in-built support to show tooltip on grid cell content but we can achieve your requirement by rendering the tooltip in the dataBound and the queryCellInfo events. To do so please follow the below steps. For now we have used the Bootstrap Tooltip for demonstration. You can use the below steps to use your desired tooltip with the grid.
1. Specify the title attribute of the cell in the queryCellInfo event.
|
$("#Grid").ejGrid({ . . . . . . . . queryCellInfo: function (args) { $(args.cell).attr({ "data-toggle": "tooltip", "data-container": "body", "title": args.data[args.column.field] }); |
2. Render the tooltip in the dataBound event as follows.
|
$("#Grid").ejGrid({ . . . . . . . . dataBound: function (args) {
$("[data-toggle=tooltip]").tooltip(); |
For your convenience we have also created a simple sample with the above code snippet. Please find the sample from the below link.
http://jsplayground.syncfusion.com/c5hykvfh
Please let us know if you have any queries.
Regards,
Madhu Sudhanan. P
Thanks for your update.
Query: “I would like, if possible, that the text displayed was filled by the values of the field tip of each country of my datasource”
From the query, we understood that you want to display the corresponding tip field value in the tooltip. If so we can simply assign the tip value from the args.data to the title attribute as follows.
|
$("#Grid").ejGrid({
. . . . . . . . queryCellInfo: function (args) { $(args.cell).attr({ "data-toggle": "tooltip", "data-container": "body", "title": args.data["tip"] }); }, . . . . . . .. |
Now while hovering on each cell, the corresponding tip field value will be display in the tooltip text.
Please let us know if we misunderstood your requirement or you have any queries.
Regards,
Madhu Sudhanan P
- Screenshot or video of the replication procedure of the issue.
- Essential studio versions.
- If possible try to reproduce the mentioned issue in the attached example.
- 5 Replies
- 4 Participants
-
BR Bruno Rodrigues
- Aug 10, 2015 03:38 PM UTC
- Feb 13, 2018 01:32 PM UTC