The Easyui Docelltip implements the mouse pointer over the cell to prompt the contents of the cell _jquery

Source: Internet
Author: User
Tags extend

1: I copied it (I can't think of any of it)--the pop-up window doesn't look good.

Extended $.extend ($.fn.datagrid.methods, {/** * cue feature * @param {} JQ * @param {} params the style of the prompt message box * @return {} */DoC 
Elltip:function (JQ, params) {function Showtip (data, TD, E) {if ($ (TD). Text () = "") return; Data.tooltip.text ($ (TD). Text ()). CSS ({top: (e.pagey +) + ' px ', Left: (E.pagex +) + ' px ', ' z-index ': $.fn.windo 
W.defaults.zindex, display: ' Block '}; 
}; 
Return Jq.each (function () {var Grid = $ (this); 
var options = $ (this). Data (' DataGrid '); 
if (!options.tooltip) {var panel = Grid.datagrid (' Getpanel '). Panel (' Panel '); var defaultcls = {' border ': ' 1px solid #333 ', ' padding ': ' 1px ', ' Color ': ' #333 ', ' background ': ' #f7f5d1 ', ' posit Ion ': ' absolute ', ' max-width ': ' 200px ', ' Border-radius ': ' 4px ', '-moz-border-radius ': ' 4px ', '-webkit-border-radiu 
S ': ' 4px ', ' Display ': ' None '} var tooltip = $ ("<div></div>"). Appendto (' body '); 
Tooltip.css ($.extend ({}, Defaultcls, params.cls)); 
Options.tooltip = tooltip; Panel.find ('. daTagrid-body '). each (function () {var Delegateele = $ (this). Find (' > Div.datagrid-body-inner '). Length? $ (this). Find (' 
> Div.datagrid-body-inner ') [0]: this; $ (Delegateele). Undelegate (' TD ', ' MouseOver '). Undelegate (' TD ', ' Mouseout '). Undelegate (' TD ', ' MouseMove '). Delegate ( 
' TD ', {' mouseover ': function (e) {if (Params.delay) {if (options.tipdelaytime) cleartimeout (options.tipdelaytime); 
var that = this; 
Options.tipdelaytime = settimeout (function () {Showtip (options, that, e); 
}, Params.delay); 
else {showtip (options, this, e); 
}, ' Mouseout ': function (e) {if (options.tipdelaytime) cleartimeout (options.tipdelaytime); 
Options.tooltip.css ({' Display ': ' None '}); 
}, ' MouseMove ': function (e) {var = this; 
if (options.tipdelaytime) {cleartimeout (options.tipdelaytime); 
Options.tipdelaytime = settimeout (function () {Showtip (options, that, e); 
}, Params.delay); 
else {showtip (options, that, e); 
} 
} 
}); 
}); 
} 
}); /** * Turn off the message prompt feature
* @param {} JQ * @return {}/cancelcelltip:function (JQ) {return Jq.each (function () {var data = $ (this). Data (' d 
Atagrid '); 
if (data.tooltip) {data.tooltip.remove (); 
Data.tooltip = null; 
var panel = $ (this). DataGrid (' Getpanel '). Panel (' Panel '); Panel.find ('. Datagrid-body '). Undelegate (' TD ', ' MouseOver '). Undelegate (' TD ', ' Mouseout '). Undelegate (' TD ', ' 
MouseMove ')} if (Data.tipdelaytime) {cleartimeout (data.tipdelaytime); 
Data.tipdelaytime = null; 
} 
}); } 
});

Call Method 1:

function Docelltip () { 
$ (' #dg '). DataGrid (' Docelltip ', {' max-width ': ' 100px '}); 
function Cancelcelltip () { 
$ (' #dg '). DataGrid (' Cancelcelltip '); 

Call Method 2:

Onloadsuccess:function (data) { 
$ (' #dg '). DataGrid (' Docelltip ', {cls:{' background-color ': ' Red '},delay:1000}); 

The above is a small set to introduce the Easyui of the Docelltip implementation of the mouse to put the cell on the prompt cell content, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.