r.a.d.controls Q2 2005中TreeView 控件遮挡问题,r.a.d.controls Q2 2005中TreeView 控件遮挡问题
【 tulaoshi.com - ASP.NET 】
最近做一个用r.a.d.controls Q2 2005做一个小东西,在使用TreeView控件的时候,如果弹出右键菜单的时候,遇到旁边有框架,那么就会产生遮挡现象。如下图:
这一点真的很让人不舒服。后来想到这个控件的右键菜单是在客户端的脚本中的,于是打开客户端脚本文件( RadTreeView_Client_4_0_4.js )。没想到打开以后,发现所有的脚本都写在一行里面,读起来很是费劲。就想了各种办法来格式化了一下。这样看起来才好一些。找到了右键菜单的控制语句,在RadTreeView.prototype.ShowContextMenu  中 rtvG76.style.top = e.clientY + document.body.scrollTop;这一句后面加入 VerifyPosition(rtvG76) ;并在合适的位置加入VerifyPosition 函数代码。VerifyPosition 是自己以前作右键菜单时控制弹出位置的代码,弹出的时候根据左右边距,自动设定显示位置。代码如下:
 function VerifyPosition(oLayer)
function VerifyPosition(oLayer) {
{
 var nWidth = oLayer.offsetWidth;
 var nWidth = oLayer.offsetWidth; var nHeight = oLayer.offsetHeight;
 var nHeight = oLayer.offsetHeight;
 if (oLayer.style.pixelLeft + nWidth  document.body.clientWidth)
 if (oLayer.style.pixelLeft + nWidth  document.body.clientWidth) {
 { oLayer.style.pixelLeft -= nWidth;
  oLayer.style.pixelLeft -= nWidth;
 if ( oLayer.style.pixelLeft < document.body.scrollLeft)
  if ( oLayer.style.pixelLeft < document.body.scrollLeft) oLayer.style.pixelLeft = document.body.clientWidth + document.body.scrollLeft - nWidth -来源:http://www.tulaoshi.com/n/20160129/1490335.html
   oLayer.style.pixelLeft = document.body.clientWidth + document.body.scrollLeft - nWidth -来源:http://www.tulaoshi.com/n/20160129/1490335.html
                    看过《r.a.d.controls Q2 2005中TreeView 控件遮挡问题》的人还看了以下文章 更多>>