easyUI 的tree 修改节点,sql递归查询

1、easyUI 的tree 修改节点:
我需要:切换语言状态,英文下, 修改根节点文本,显示英文。
操作位置:在tree的显示 $('#tree').tree(),onLoadSuccess事件方法中,参数:node,data(详见easyUI文档)
代码:                 var t = $(this);                 
                    if (data) {
                        var troot = t.tree("getRoot");
                        if (troot) {
                            troot.text = 'MechinalCategory';
                            t.tree("update", troot);
 
                        };}
与easyui 介绍的update方法有些不同,
easyui,文档update方法是这样介绍的
 
更新指定的节点,'param' 参数有下列属性:
target(DOM 对象,要被更新的节点)、id、text、iconCls、checked,等等。
 
代码实例:
// update the selected node text
var node = $('#tt').tree('getSelected');
if (node){
    $('#tt').tree('update', {
        target: node.target,
        text: 'new text'
    });
}
不过我在用时,总是报错typeError:无法获取指定的属性什么check之类的。
我当时是这么用的
             var troot = t.tree("getRoot");
                        if (troot) {
                            troot.text = 'MechinalCategory';
                            t.tree("update", {target:troot,text:'MechinalCategory'});
                            }
我也不是很清楚这是什么原因造成的,如果你知道,请一定要告诉我,谢谢!
2、查找所有子节点
with tab as
(
 select IsId,ParentId,CategoryName from tb_MechanicalEquipmentCategory where IsId=116--父节点
 union all
 select b.IsId,b.ParentId,b.CategoryName 
 from
  tab a,--父节点数据集
  tb_MechanicalEquipmentCategory b--子节点数据集 
 where b.ParentId= a.IsId --子节点数据集.ID=父节点数据集.parendID
 )
select * from tab
 
3、查找所有父节点
with tab as
(
 select Type_Id,ParentId,Type_Name from Sys_ParamType_V2_0 where Type_Id=316--子节点
 union all
 select b.Type_Id,b.ParentId,b.Type_Name 
 from
  tab a,--子节点数据集
  Sys_ParamType_V2_0 b  --父节点数据集
 where a.ParentId=b.Type_Id  --子节点数据集.parendID=父节点数据集.ID
)
select * from tab;
4、比较复杂的sql查询,主要是将查找所有子节点的数据,再分页。三部分之一:
with tab as (select IsId,ParentId,CategoryName from tb_MechanicalEquipmentCategory where IsId=4 union all select b.IsId,b.ParentId,b.CategoryName from tab a, tb_MechanicalEquipmentCategory b where b.ParentId= a.IsId) 
三部分之二:
 ,m as(select row_number() over(order by Guid  asc) rowid,* from VW_MechanicalEquipment where 1=1 and VW_MechanicalEquipment.CategoryId in(select isid from tab) )
最后
select * from m where rowid  between (1-1)*10+1 and 10*1
 
原文地址:https://www.cnblogs.com/marryZheng/p/5254875.html