EasyUI Forum
November 04, 2025, 04:17:37 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Tooltip on edatagrid does not disappear  (Read 9187 times)
ShockRaver
Newbie
*
Posts: 8


View Profile
« on: July 25, 2014, 04:29:33 AM »

Good day,

I have used the tooltip on my editable datagrid. The tooltip itself works, but when the tooltip is shown when i doucbleclick (to edit) then the tooltip won't disappear, not even after editting.
I need to refresh the page to get rid of the tooltip.

Any ideas?

Here's the piece of code:

Code:
function formatA(value,row,index){
return '<span data-p1='+index+' class="easyui-tooltip">' + value + '</span>';
}
function createTooltip(){
    $('#tt').datagrid('getPanel').find('.easyui-tooltip').each(function(){
        var index = parseInt($(this).attr('data-p1'));
        $(this).tooltip({
            content: $('<div></div>'),
            onUpdate: function(cc){
                var row = $('#tt').datagrid('getRows')[index];
                var content = '<div>'+row.comments+'</div>';
                cc.panel({
                    width:200,
                    content:content
                });
            },
            position:'left'
        });
    });
}

And the datagrid i added these:

<th data-options="field:'comments',width:100,align:'left',sortable:true,formatter:formatA">Opmerkingen</th>

and

 onLoadSuccess function calls "createTooltip()"
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 25, 2014, 08:36:30 AM »

After edit or cancel a row, please re-create tooltip again on this row. Try the code below:
Code:
$('#tt').edatagrid({
onBeforeEdit:function(index,row){
var opts = $(this).edatagrid('options');
var tr = opts.finder.getTr(this, index);
tr.find('.easyui-tooltip').tooltip('destroy');
},
onAfterEdit:function(index,row){
createTooltip()
},
onCancelEdit:function(index,row){
createTooltip()
},
onLoadSuccess:function(){
createTooltip()
}
});
Logged
ShockRaver
Newbie
*
Posts: 8


View Profile
« Reply #2 on: July 25, 2014, 10:11:15 PM »

Thank you, works great!

tried it with onEdit and onAfterEdit, but didn't think of onBeforeEdit... Think that did the trick Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!