EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jega on April 25, 2025, 02:21:49 PM



Title: [SOLVED] Datagrid Cell Tooltip individual text
Post by: jega on April 25, 2025, 02:21:49 PM
Hi.

Filling a datagrid with this json (not formatted here): number_7 and _8 is the column field name

number_7:"11111111"
number_7:"22222222"
tooltipText_7:"Tooltip for column _7"
tooltipText_8:"Tooltip for cell on column _8"


Using formatTooltip

   function formatTooltip(value,row,index){
      var fieldName = this.field
      var fieldNumber = fieldName.split('_')
      return '<div title="'+row['tooltipText_'+fieldNumber[1]]+'">'+value+'</div>'
   }

Then it shows tooltipText_7 and _8 on the 2 cells on mouse over, as expected

But how can i use the easyui-tooltip instead of the div title attr

Any help ??


Title: Re: Datagrid Cell Tooltip individual text
Post by: jarry on April 29, 2025, 12:22:40 AM
Please call this code to convert the tooltip.
Code:
function formatTooltip(value, row, index) {
var fieldName = this.field
var fieldNumber = fieldName.split('_')
return '<div class="dg-tp" title="' + row['tooltipText_' + fieldNumber[1]] + '">' + value + '</div>'
}
$(function () {
$('#dg').datagrid({
// ...,
onLoadSuccess: function (data) {
$(this).datagrid('getPanel').find('.dg-tp').tooltip()
}
})
})


Title: Re: Datagrid Cell Tooltip individual text
Post by: jega on April 29, 2025, 06:46:34 AM
Hi Jarry.

Works perfect. Thanks