0

代码如下

问题是当鼠标移出填充网格名称字段的单元格时,有时带有 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),
                                });
                         });

              }
            });
4

1 回答 1

0

您好尝试像这样连接 OnMouseOut。

首先设置您的 Contentpane :

myContentPane = new ContentPane({
                id:"myContentPane",
                style: "width:300px;background:#dddddd",
                content:"<p style='text-align:center;'>"....
                }, "MyContentPaneDiv");

连接 onMouseOut:

      myContentPane.on("MouseOut",function(){
               //do what you want to do;
       });

认为这应该可以帮助你。

问候

于 2013-08-13T11:29:50.487 回答