EasyUI Forum
June 25, 2024, 10:49:03 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: DataGrid and datalist cannot be used in tooltip  (Read 7826 times)
officecode
Jr. Member
**
Posts: 69


View Profile Email
« on: September 23, 2017, 06:57:40 AM »

The data in the following code cannot be displayed. Ask for help. Thanks!

Code:

onLoadSuccess:function(data){
$('.img').tooltip({
content: function(){return $('<div></div>')},
position: 'right',
onUpdate:function(content){
content.datalist({
title:'datalist',
iconCls:'icon-tip',
width: 278,
height:120,
lines:true,
data:[
{title:'aaa'}
],
textField:'title'
});
}
});
},

Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #1 on: September 23, 2017, 08:05:47 PM »

After testing, if I change the URL attribute in datalist, the data can be obtained, but cannot be displayed in the datalist.
Does tooltip not support this type of writing? Is there anything else that can be used to display DataGrid data in tooltip?
This problem has been bothering me for a long time.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2267


View Profile Email
« Reply #2 on: September 23, 2017, 11:05:05 PM »

You should resize the datalist after display the tooltip dialog.
Code:
onUpdate: function(content){
content.datalist({
title:'datalist',
iconCls:'icon-tip',
width: 278,
height:120,
lines:true,
data:[
{title:'aaa'}
],
textField:'title'
});
},
onShow: function(){
var opts = $(this).tooltip('options');
$(opts.content).datalist('resize');
}
Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #3 on: September 24, 2017, 02:14:11 AM »

Thanks for your reply.
After adding the onShow event, datalist still does not display the data.

You should resize the datalist after display the tooltip dialog.
Code:
onUpdate: function(content){
content.datalist({
title:'datalist',
iconCls:'icon-tip',
width: 278,
height:120,
lines:true,
data:[
{title:'aaa'}
],
textField:'title'
});
},
onShow: function(){
var opts = $(this).tooltip('options');
$(opts.content).datalist('resize');
}
Logged
jarry
Administrator
Hero Member
*****
Posts: 2267


View Profile Email
« Reply #4 on: September 24, 2017, 06:28:18 AM »

Please look at this example http://code.reloado.com/inodal/edit#javascript,html,live
Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #5 on: September 24, 2017, 09:15:36 AM »

Appreciated your great help,Dear Wink...I find the root cause that the property should be "content: $('<div></div>'),"
But I'm confused still that,tooltip can't be displayed from the second row of datagrid..

Code:

<table id="dd"></table>
<script>
$(function(){
$('#dd').datagrid({
title:'datagrid',
width:300,
data:[
{id:1,name:'abc1',age:28},
{id:2,name:'abc2',age:28},
{id:3,name:'abc3',age:28},
{id:4,name:'abc4',age:28},
{id:5,name:'abc5',age:28},
],
columns:[[
{field:'id',title:'id'},
{field:'name',title:'name',formatter:function(val,row){
return '<a class="con" href="javascript:void(0)">'+val+'</a>';
}},
{field:'age',title:'age'}
]],
onLoadSuccess:function(){
$('.con').tooltip({
content: $('<div></div>'),
onUpdate: function(content){
content.datalist({
title:'datalist',
iconCls:'icon-tip',
width: 278,
height:120,
lines:true,
data:[
{title:'aaa'}
],
textField:'title'
});
},
onShow: function(){
var opts = $(this).tooltip('options');
$(opts.content).datalist('resize');
}
});
}
});
});
</script>

Logged
jarry
Administrator
Hero Member
*****
Posts: 2267


View Profile Email
« Reply #6 on: September 24, 2017, 11:49:11 PM »

Please use this code instead.
Code:
onLoadSuccess:function(){
  $('.con').each(function(){
    $(this).tooltip({
      content: $('<div></div>'),
      onUpdate: function(content){
        content.datalist({
          title:'datalist',
          iconCls:'icon-tip',
          width: 278,
          height:120,
          lines:true,
          data:[
            {title:'aaa'}
          ],
          textField:'title'
        });
      },
      onShow: function(){
        var opts = $(this).tooltip('options');
        $(opts.content).datalist('resize');
      }
    })
  })
}
Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #7 on: September 25, 2017, 07:14:10 PM »

The problem has been solved. Thank you very much!
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!