Continue with my last article, set cookies up and take them out
Copy Code code as follows:
var userName = Ext.util.Cookies.get (' UserName ');
var userauthority = Ext.util.Cookies.get (' userauthority ');//0,1,2
We can use it next.
Copy Code code as follows:
The tree menu is displayed with different permissions
var treeurl= '.. /store/cctree ' +userauthority+ '. JSON ';
var treestore = ext.create (' Ext.data.TreeStore ', {
proxy:{
Type: ' Ajax ',
Url:treeurl
}
});
My tree menu is read locally, with the name Cctree0.json~cctree2.json
When you create a tree menu, just use this treestore, and omit some of the code below.
Copy Code code as follows:
Tree Menu
var menutree=ext.create (' Ext.tree.Panel ', {
Title: ' Simple Tree ',
WIDTH:200,
HEIGHT:650,
Usearrows:true,
store:treestore,//here to quote
Rootvisible:false,
RenderTo:Ext.getBody (),
listeners:{
Itemclick:function (view,rec,el,index,e) {
alert (rec.id);
if (rec.raw.id== "01") {//Point-to-Point first operation, other similar
The following JSON content is attached for reference
Copy Code code as follows:
[
{ID: "A", Text: "First", Expanded:false,leaf:true, "Children": [
],url: ' login.html '},
{ID: "", Text: "Second", Expanded:true, "Children": [
{ID: "021", Text: "Third", leaf:true},
{ID: "022", Text: "Fourth", leaf:true}
]},
{ID: "", Text: "Fifth", Expanded:true, "Children": [
{ID: "031", Text: "Sixth", Leaf:true},
{ID: "032", Text: "Seventh", Leaf:true}
]}
]
The above is just my own thought out a way to achieve user classification ... There is a better way please leave a message. Thank you