EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Coder on February 26, 2020, 06:26:41 PM



Title: [SOLVED] remove dynamically created tooltip
Post by: Coder on February 26, 2020, 06:26:41 PM
5 cell in datagrid have dynamically created tooltip
after watching 100 pages with 100 rows per page
html have ~50 000
Code:
<div tabindex="-1" class="tooltip" ...

but
Code:
function dgOnBeforeLoad(){
 $('#dg').datagrid('getPanel').find('.easyui-tooltip').tooltip('destroy');
}

didn work ;(

// create tooltip:
Code:
function dgOnRowsLoad(){
 $('#dg').datagrid('getPanel').find('.easyui-tooltip').tooltip({showDelay: 100 });
};


Title: how to check initialization of tooltip ?
Post by: Coder on February 27, 2020, 06:16:43 AM
Code:
$('#dg').datagrid('getPanel').find('.easyui-tooltip')
.each(function(idx,elm){
let tip = $(elm).tooltip('tip');
$(elm).tooltip('destroy');
// console.log(idx, tip);
if(tip != undefined){$(tip).remove();}
});

if elm is not initialized this
let tip = $(elm).tooltip('tip');
trow error.

How check initialization of tooltip?


Title: Re: [SELF SEMI SOLVE] remove dynamically created tooltip
Post by: jarry on February 27, 2020, 07:38:48 AM
Please try this code.
Code:
if ($(elm).data('tooltip'){
  var tip = $(elm).tooltip('tip');
  ...
}


Title: need to sleep more: I know this method :)
Post by: Coder on February 28, 2020, 06:26:53 AM
Thnx!