ExtJS樹控制項,完成機構樹的呈現

2021-08-30 14:29:20 字數 1667 閱讀 6974

這裡僅僅是乙個樹控制項的展現而已,並沒有做其他操作,其目的主要是熟悉使用extjs實現樹結構資料的展現。裡面的一些具體引數的含義參照文件,這裡我就把一些需要增加或修改地方的**貼出來:

組織機構實體類:

@entity

@table(name="t_org")

public class organization

//是否是葉子節點

public boolean getleaf()

return false; }

public integer getid()

public void setid(integer id)

public string getname()

public void setname(string name)

public string getsn()

public void setsn(string sn)

public string getdescription()

public void setdescription(string description)

public organization getparent()

public void setparent(organization parent)

public setgetchildren()

public void setchildren(setchildren)

}

下面是請求action類:

@controller("orgaction")

@scope("prototype")

public class orgaction extends baseaction implements modeldriven catch (exception e)

pagermodel pm = orgmanager.searchorgs(pid);

tojson(pm.getdatas());

}public object getmodel()

return org;

} public organization getorg()

public void setorg(organization org)

public int getparentid()

public void setparentid(int parentid)

}

下面貼出js檔案:注意這裡的nodetype: 'async',//非同步請求,引數並未起作用,主要原因是由我們在實體類中設定了雙向關聯,hibernate載入資料時一塊給載入了。

ext.blank_image_url = 'ext-3.1.1/resources/images/default/s.gif';//指定空白的位置,不指定會從網上查詢

ext.onready(function()

});tree.on("click",

function(node,e)

);// render the tree

tree.render('orgtree');

});

頁面:

下面來看看效果圖吧:

ExtJs下拉樹的實現

直接上 ext.ux.treecombo ext.extend ext.form.combobox,maxheight 300,editable false,mode local triggeraction all rootvisible false,selectmode all cfg store...

extjs 選單樹的後台

因為自已只用到兩層的樹。所以可能功能不是很完善。把 貼出來讓大夥瞅瞅。def getmenulist menustring lv1list menu.find by sql select from menus where menuid leve lv2list menu.find by sql se...

ExtJs建立動態樹的方法

前段時間公司安排我做有關樹方面的內容,實現部門樹和崗位樹等樹的任務,初學extjs且學藝不精,花了乙個星期將其搞定,也算有所成就吧!再此記下用於以後學用!呵呵 以下為部門樹的案例 部門表如圖 前端js 如下 this.treedepart new ext.tree.treepanel dataurl...