树中的数据来自SQL(X5)

前台界面

   <item id="customBarItem3" name="cmbSpeciality-item"> 
      <xhtml:span id="cmbSpeciality" style="width:120px;"/>    //必须是容器,而不是output
   </item>  

JS实现
 mainActivity.mdDefaultLoad = function(event){
 var sql = "select  tx.* from ( select x.*,(select count(fid) from pmb_view_project where fparentid = x.fcode) as cnt "
   + "from pmb_view_project x ) tx  where tx.fparentid "; 
 var dataMain = justep.xbl("dataMain");
 if(!dataMain) return ; 
 pmcSystem.bindOutputAsComboBox("output3", "0=分部工程,1=子分部工程,2=分项工程", {disabled: true, border: false});  
 var element = pmcSystem
   .generateTreeViewComboBox(
     "",
     {
      tvDropBoardWidth : 400,
      tvDropBoardHeight : 400,
      tvMultiChoose : false,
      tvLoadChildren : {
       root : {
        condition : "false",
        dataModel : "/PMB/costManagement/data",
        sql : (sql + "is null and tx.cnt>0"),
        mapping : "fname=name,fcode=code,cnt,fPrjCatalogname=catalogname,fkind=kind",
        name : "[this.name]",
        value : "[this.code]",
        hasChildren : "[CODE]pmcSystem.textAsInt('[this.cnt]', 0) > 0",
        icon : "/UI/system/images/org/dept.gif"
       },
       c : {
        condition : "true",
        dataModel : "/PMB/costManagement/data",
        sql : (sql + "='[this.code]'"),
        mapping : "fname=name,fcode=code,cnt,fPrjCatalogname=catalogname,fkind=kind",
        name : "[this.name]",
        value : "[this.code]",
        hasChildren : "[CODE]pmcSystem.textAsInt('[this.cnt]', 0) > 0",
        icon : "/UI/system/images/org/dept.gif"
       }
      }
     }, null, null, function(main, dropDown, input, option,
       value, display, onGetValues, dataList) {
      var fKind = onGetValues(function(node) {
       return node.data.kind;
      });
      var kind = pmcSystem.textAsInt(fKind, 0);
      if (kind == 0){
      alert("请选择子节点");
      return false;
      }else{
      return true;
      }
     }, function(main, dropDown, input, option, value, display,
       onGetValues, dataList) {
      var catalogname = onGetValues(function(node) {
       return node.data.catalogname;
      });
      document.__special = {
       id : value,
       name : display,
       cagname : catalogname
      };
      document.getElementById("projectSort").value = document.__special.cagname;
      dataMain.setTreeRootFilter("PMB_WBSTree_Templ.fSpecialtyID='"+document.__special.id+"' and PMB_WBSTree_Templ.fParent IS NULL");
      dataMain.refreshData();
     });
 var c = document.getElementById("cmbSpeciality");
 if (c)
  c.appendChild(element);
 pmcSystem.removeToolbarItemEffect("tbsHeader", "cmbSpeciality-item");
};     

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值