如何设置ext treegrid 节点不展开 急用 能行就给分
展开全部
extjs什么版本?
VieportMenu=new Ext.tree.TreePanel( {
title:'操作菜单',
region: 'west',
minSize: 170,
maxSize: 170,
width: 170,
collapsible:true,
split:true,//是否可拖拽改变大小
autoScroll :true,//滚动条
animate :true,//动画效果
containerScroll :true,//收缩按钮
rootVisible:false,//隐藏根节点
lines:false,//是否有关联线
dataUrl :'initLoginMenu.action',//后台获取数据地址
root: {text: '全部功能'},
listeners:{
'click':function(node){
alert(node.id);
}
}
});
数据Model是这样的:
public class Menu {
public Menu() {
}
private String id;
private String text;
private boolean leaf;
private String cls;
private boolean checked;
private String iconCls;
private String href;
private String handler;
private String qtip;
private List<Menu> children;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public boolean isLeaf() {
return leaf;
}
public void setLeaf(boolean leaf) {
this.leaf = leaf;
}
public List<Menu> getChildren() {
return children;
}
public void setChildren(List<Menu> children) {
this.children = children;
}
public String getCls() {
return cls;
}
public void setCls(String cls) {
this.cls = cls;
}
public boolean getChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public String getIconCls() {
return iconCls;
}
public void setIconCls(String iconCls) {
this.iconCls = iconCls;
}
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public String getHandler() {
return handler;
}
public void setHandler(String handler) {
this.handler = handler;
}
public String getQtip() {
return qtip;
}
public void setQtip(String qtip) {
this.qtip = qtip;
}
}
ACTION里面这么写
public String execute() throws Exception {
response.setCharacterEncoding("UTF-8");
List<Menu> listvo =sms_DeptService.getTreeData("0");
JsonConfig config = new JsonConfig();
try {
JSONArray testArray = JSONArray.fromObject(listvo,config);
response.getWriter().print(testArray.toString());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
VieportMenu=new Ext.tree.TreePanel( {
title:'操作菜单',
region: 'west',
minSize: 170,
maxSize: 170,
width: 170,
collapsible:true,
split:true,//是否可拖拽改变大小
autoScroll :true,//滚动条
animate :true,//动画效果
containerScroll :true,//收缩按钮
rootVisible:false,//隐藏根节点
lines:false,//是否有关联线
dataUrl :'initLoginMenu.action',//后台获取数据地址
root: {text: '全部功能'},
listeners:{
'click':function(node){
alert(node.id);
}
}
});
数据Model是这样的:
public class Menu {
public Menu() {
}
private String id;
private String text;
private boolean leaf;
private String cls;
private boolean checked;
private String iconCls;
private String href;
private String handler;
private String qtip;
private List<Menu> children;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public boolean isLeaf() {
return leaf;
}
public void setLeaf(boolean leaf) {
this.leaf = leaf;
}
public List<Menu> getChildren() {
return children;
}
public void setChildren(List<Menu> children) {
this.children = children;
}
public String getCls() {
return cls;
}
public void setCls(String cls) {
this.cls = cls;
}
public boolean getChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public String getIconCls() {
return iconCls;
}
public void setIconCls(String iconCls) {
this.iconCls = iconCls;
}
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public String getHandler() {
return handler;
}
public void setHandler(String handler) {
this.handler = handler;
}
public String getQtip() {
return qtip;
}
public void setQtip(String qtip) {
this.qtip = qtip;
}
}
ACTION里面这么写
public String execute() throws Exception {
response.setCharacterEncoding("UTF-8");
List<Menu> listvo =sms_DeptService.getTreeData("0");
JsonConfig config = new JsonConfig();
try {
JSONArray testArray = JSONArray.fromObject(listvo,config);
response.getWriter().print(testArray.toString());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
追问
3.2
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询