easyUI的tree怎么展示层级关系

我姓韩我心寒 2017-02-12 03:43:55
今天做easyUI tree的时候,遇到了这个问题,没有层级关系,关于这个问题我想了两三天也不知道怎么解决。
想要展现的结果是第一次只出来一个根节点首页,接着点击首页出来首页下的子节点,再点击出来子节点下的子节点。
还望大神们指教一二,鄙人不甚感激!下面是效果图,后台实现和数据库
...全文
377 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
x业精于勤x 2017-02-13
  • 打赏
  • 举报
回复
给你个参考 http://www.jeasyui.net/plugins/185.html
什么都不能 2017-02-12
  • 打赏
  • 举报
回复
<%@ page language="java" pageEncoding="utf-8"%><%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%><%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %><ul class="nav navbar-nav nav-tables"><c:forEach var="menu" items="${menus}">
    <li class="dropdown"><a href="<c:url value="${menu.menuUrl}" />" <c:if test="${fn:length(menu.childMenus) > 0}">data-toggle="dropdown"</c:if> <c:if test="${menu.menuUrl != '#'}">target="sys_content"</c:if>><c:out value="${menu.menuName}" /><c:if test="${fn:length(menu.childMenus) > 0}"><b class="caret"></b></c:if></a><c:if test="${fn:length(menu.childMenus) > 0}"><ul class="dropdown-menu"></c:if>
        <c:forEach var="child" items="${menu.childMenus}"><li <c:if test="${fn:length(child.childMenus) > 0}">class="dropdown-submenu"</c:if>><a href="<c:url value="${child.menuUrl}" />" <c:if test="${fn:length(child.childMenus) > 0}">data-toggle="dropdown"</c:if>  <c:if test="${child.menuUrl != '#'}">target="sys_content"</c:if>><c:out value="${child.menuName}" /></a><c:if test="${fn:length(child.childMenus) > 0}"><ul class="dropdown-menu"></c:if><c:forEach var="leaf" items="${child.childMenus}"><li><a href="<c:url value="${leaf.menuUrl}" />"  target="sys_content"><c:out value="${leaf.menuName}" /></a></li></c:forEach>
    <c:if test="${fn:length(child.childMenus) > 0}"></ul></c:if></li>
</c:forEach><c:if test="${fn:length(menu.childMenus) > 0}"></ul></c:if></li></c:forEach>
</ul>
什么都不能 2017-02-12
  • 打赏
  • 举报
回复
我的不是easyUI的,不过也是层级机构的
我姓韩我心寒 2017-02-12
  • 打赏
  • 举报
回复
能看一下你的效果吗
什么都不能 2017-02-12
  • 打赏
  • 举报
回复
@Override
	public List<SysMenuBean> queryMenus() throws ServiceException {
		try{
			List<SysMenuBean> resultMenuList = new ArrayList<SysMenuBean>();
			List<SysMenuBean> menuList = sysMenuDao.queryMenus();
			for(SysMenuBean menu : menuList) {
				String parentMenuId = menu.getParentMenuId();
				if(StringUtils.isEmpty(parentMenuId)){
					menu.setChildMenus(genMenu(menuList, menu.getMenuId()));
					resultMenuList.add(menu);
				}
			}
			return resultMenuList;
		} catch(DaoException e) {
			log.error("queryMenus", e);
			throw new ServiceException(e);
		}
	}
	
	/*
	 * 设置菜单
	 */
	private List<SysMenuBean> genMenu(List<SysMenuBean> menus, String parentMenuId){
		List<SysMenuBean> list = new ArrayList<SysMenuBean>();
		for(SysMenuBean menu: menus) {
			String parentId = menu.getParentMenuId();
			if(parentMenuId.equals(parentId)){
				menu.setChildMenus(genMenu(menus, menu.getMenuId()));
				list.add(menu);
			}
		}
		return list;
	}
我姓韩我心寒 2017-02-12
  • 打赏
  • 举报
回复
这个是做出来的样子
这个是后台实现
这个是数据库表
请大神门指点

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧