回复 1楼angry003的帖子
在MouseOver事件里去设置显示wijmo.Tooltip(show/hide方法展示和隐藏Tooltip)。
Tooltip类的API可以参考产品文档:
http://wijmo.com/5/docs/topic/wijmo.Tooltip.Class.html
参考代码:- // monitor the mouse over the grid
- flex.hostElement.addEventListener('mousemove', function (evt) {
- var ht = flex.hitTest(evt);
- if (!ht.cellRange.equals(rng)) {
- // new cell selected, show tooltip
- if (ht.cellType == wijmo.grid.CellType.Cell) {
- rng = ht.cellRange;
- var cellElement = document.elementFromPoint(evt.clientX, evt.clientY),
- cellBounds = wijmo.Rect.fromBoundingRect(cellElement.getBoundingClientRect()),
- data = wijmo.escapeHtml(flex.getCellData(rng.row, rng.col, true)),
- tipContent = 'cell (' + rng.row + ' ' + rng.col + ') contains "<b>' + data + '</b>"';
- if (cellElement.className.indexOf('wj-cell') > -1) {
- tip.show(flex.hostElement, tipContent, cellBounds);
- } else {
- tip.hide(); // cell must be behind scroll bar...
- }
- }
- }
- });
- flex.hostElement.addEventListener('mouseout', function () {
- tip.hide();
- rng = null;
- });
复制代码 |