欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ExtJS4利根據(jù)登錄后不同的角色分配不同的樹形菜單

 更新時間:2014年05月02日 11:56:33   作者:  
這篇文章主要介紹了ExtJS4利根據(jù)登錄后不同的角色分配不同的樹形菜單,需要的朋友可以參考下
繼續(xù)我的上一篇,設(shè)置好cookie后,將他們?nèi)〕鰜?
復(fù)制代碼 代碼如下:

var userName = Ext.util.Cookies.get('userName');
var userAuthority = Ext.util.Cookies.get('userAuthority');//0,1,2

接下來就可以用了
復(fù)制代碼 代碼如下:

//樹形菜單根據(jù)不同權(quán)限顯示
var treeUrl='../store/ccTree'+userAuthority+'.json';


var treeStore = Ext.create('Ext.data.TreeStore', {

proxy:{
type:'ajax',
url:treeUrl
}
});

我的樹形菜單從本地讀取,名字分別為ccTree0.json~ccTree2.json

建立樹形菜單的時候只要用這個treeStore就行了,下面省略了部分代碼
復(fù)制代碼 代碼如下:

//樹形菜單

var menuTree=Ext.create('Ext.tree.Panel', {
// title: 'Simple Tree',
width: 200,
height: 650,
useArrows:true,
store: treeStore,//在這里引用
rootVisible: false,
renderTo: Ext.getBody(),
listeners:{
itemclick: function(view,rec,el,index,e) {
// alert(rec.id);
if(rec.raw.id=="01"){//對點了第一個的操作,其他類似

下面貼下json的內(nèi)容以供參考
復(fù)制代碼 代碼如下:

[
{id:"01",text:"第一個",expanded:false,leaf:true,"children":[

],url:'login.html'},
{id:"02",text:"第二個",expanded:true,"children":[
{id:"021",text:"第三個",leaf:true},
{id:"022",text:"第四個",leaf:true}

]},
{id:"03",text:"第五個",expanded:true,"children":[
{id:"031",text:"第六個",leaf:true},
{id:"032",text:"第七個",leaf:true}

]}

]

以上只是我自己想出來的一種實現(xiàn)用戶分類的方法。。。有更好的方法請留言。。謝謝

相關(guān)文章

最新評論