EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: tomb on September 18, 2014, 01:14:18 PM



Title: Tooltips in tree stuck indefinitely when tree updates
Post by: tomb on September 18, 2014, 01:14:18 PM
I have a easyui-tree and it's content occasionally gets refreshed, which will cause it to reload it through a 'loadData' call.  Almost as if there was a timer that triggered a 'loadData' call.  This tree also uses a formatter, which creates easyui-tooltips on some of the entries.  This works great until a refresh happens to occur while a tooltip is showing.  In which case it gets stuck on the screen indefinitely.

I tried a few things but haven't managed to fix it yet.  I currently use the following to make the tooltips work:

Code:
onLoadSuccess:function() {
$.parser.parse($(this));
}

And I tried:

Code:
onLoadSuccess:function() {
$(this).find('.tooltip-f').tooltip('destroy');
$.parser.parse($(this));
}

And I also tried calling .find('.tooltip-f').tooltip('destroy'); right before calling 'loadData', but none of these seem to actually get rid of any displaying tooltips.

I'm also worried a little bit about leaking memory/dom objects.


Title: Re: Tooltips in tree stuck indefinitely when tree updates
Post by: stworthy on September 18, 2014, 08:22:39 PM
Please try this:
Code:
$('#tt').tree({
formatter:function(node){
return '<span class="t1" title="'+node.text+'">'+node.text+'</span>';
},
loadFilter:function(data){
$(this).find('span.t1').tooltip('destroy');
return data;
},
onLoadSuccess:function(){
$(this).find('span.t1').tooltip();
}
})