代码如下
问题是当鼠标移出填充网格名称字段的单元格时,有时带有 html 内容的 contentPane 无法关闭。
var myContentPane;
grid.on("CellMouseOver",function(evt){
var cell=evt.cell;
rowData=grid.getItem(evt.rowIndex);
if(cell.field=="name"){
require([
"dojox/layout/ContentPane",
"dijit/popup"
], function(ContentPane, popup){
if(myContentPane){
popup.close(myContentPane);
}
myContentPane = new ContentPane({
style: "width:300px;background:#dddddd",
content:"html content string has some links in it",
onMouseLeave:function(){
popup.close(myContentPane);
}
});
popup.open({
popup: myContentPane,
around: dom.byId(rowData.name),
});
});
}
});