Ext Tree Checkbox 单选

Extjs-Code//控件树   
var dsReLoad=function()
{
      Ctree.getSelectionModel().getSelectedNode().parentNode.reload();
}
var dsLoader = new Ext.tree.TreeLoader({
            dataUrl:'../data/json.aspx?iType='+ddlType.getValue()+'&sChkIDs=',
            uiProviders:{
                'col': Ext.tree.ColumnNodeUI
            },
            listeners:{
                loadexception :function(loader,node,response)
                {
                    //alert(response.responseText);
                },
                load :function(loader,node,response)
                {
                }
            }
        });
var rootNode = new Ext.tree.AsyncTreeNode({
    text:"全部",draggable:false,expanded:true,id:1
    });
var Ctree  = new Ext.tree.TreePanel({
       // el:'tree-ct',
        id:'treeApp',
        width:130,
        layout:'fit',
        collapsible :true,
        region:'west',
        height:700,
        collapseMode:'mini',
        border:false,
        style:'border-right:1px solid #8db2e3;border-top:1px solid #8db2e3;',
        rootVisible:true,
        autoScroll:true,
        split:true,
        enableDD:true, //结点是否可拖动
//        tbar:[
//            '统计级别:',ddlType
//            //new Ext.Button({id:'IpAddrSegadd',text:'aaa',iconCls:'delete',handler:function(){alert( GetCheckedNe());}  })
//            ],
        loader: dsLoader,

        root:rootNode ,

   listeners:{
       load :function(node)
      {
          ToUrl();
          rootNode.eachChild(function(child){//单选功能
              child.on("checkchange",function(node,checked){
                  if(checked){
                      rootNode.eachChild(function(sibling_child){
                          if(sibling_child!=child&&sibling_child.attributes.checked){
                              sibling_child.attributes.checked=!checked;
                              sibling_child.ui.checkbox.checked=!checked;
                           }
                      });
                  }
              });
          });
      }
  }
    });

复选请看Extjs中文论坛:http://extjs.org.cn/index.php?q=node/223

posted on 2009-12-24 11:15  ToKens  阅读(1926)  评论(0编辑  收藏  举报