改造 treeview.htc

来源:互联网 发布:淘宝测款视频教程 编辑:程序博客网 时间:2024/06/10 14:41

-W B W Y-
2005 03 30

1、修改"retrieving nodes..." 为中文"请稍候..."

打开wwwroot/webctrl_client/1_0/treeview.htc,查找替换"retrieving nodes..." 为中文"请稍候...",保存编码为UTF-8,否则会出现乱码。

2、显示ToolTips

打开wwwroot/webctrl_client/1_0/treeview.htc,按如下代码更改。

function generateItem(el, nodeClass)
{ ...
str = getNodeAttribute(el, "Target");
if (str != null)
elAnchor.target = str;
//增加tooltips
str = getNodeAttribute(el, "ToolTips");
if (str != null)
elAnchor.title = str;
...

使用treenode.setAttribute("ToolTips","some text");增加ToopTips属性。

3、解决setAttribute("Expanded",true)的错误

打开wwwroot/webctrl_client/1_0/treeview.htc,按如下代码更改。

function doNodePlusMinusClick(el)
{
if (g_bInteractive == false)
return false;

// The element, which is in a content node outside of the document, is outside the event hierarchy.
// Fire the event ourselves, rather than relying on bubbling.
//判断event是否为空
if(event!=null)event.cancelBubble = true;

...

4、使节点treenode不能被选择

打开wwwroot/webctrl_client/1_0/treeview.htc,按如下代码更改。

function doNodeClick(el)
{
    if (g_bInteractive == false)
        return;
       
    g_nodeClicked = el;

    // The element, which is in a content node outside of the document, is outside the event hierarchy.
    // Fire the event ourselves, rather than relying on bubbling.
    event.cancelBubble = true;
    el.fireEvent("onclick");        // Execute our onclick handler
    //不能选择,则屏蔽事件
    var str = getNodeAttribute(el, "UnSelect");
    if (str != null && str == "true")
  return false;
  ...

  使用treenode.setAttribute("UnSelect","true");增加UnSelect属性。

原创粉丝点击