JAVAEE工程笔记5---MiniUI-Tree

HTML

	<div size="240" showCollapseButton="true">
		<div class="mini-panel" title="业务地区查询" iconCls="icon-add" style="width:100%;height:100%;" showToolbar="false" showFooter="true">
			
			<div class="mini-toolbar" style="text-align:center;line-height:30px;" borderStyle="border-left:0;border-top:0;border-right:0;">
		          <label >名称:</label>
		          <input id="key" class="mini-textbox" style="width:100px;" onenter="onKeyEnter"/>
		          <a class="mini-button" style="width:60px;" onclick="searchTree()">查询</a>
		    </div>
		    <div class="mini-fit">
                <ul id="tree1" class="mini-tree" style="width:100%;height:100%;" dataField="areas" showTreeIcon="true" textField="name" 
		           	idField="id" parentField="parentId" resultAsTree="false"  url="/area.do?method=paramListByParentIdAndId"
		            contextMenu="#treeMenu" expandOnLoad="0">
		        </ul>
		        <ul id="treeMenu" class="mini-contextmenu"  onbeforeopen="onBeforeOpen">        
				    <li  iconCls="icon-add" onclick="addNode()">新增节点</li>
					<li iconCls="icon-edit"  onclick="editNode()">编辑节点</li>
					<li  iconCls="icon-remove" onclick="removeNode()">禁用</li>        
				</ul>
	        </div>
		 </div>    
	 </div>    

JS

tree.on("nodeselect", function (e) {
	var node = e.node;
    var isLeaf = e.isLeaf;
    if (isLeaf) {
        showTab(node);
    }else{
    	 var thisnode = tree.getSelectedNode();
    	 var parentId = thisnode.id
         grid.load({parentId: parentId});
    }
});

function searchTree() {
 
    var key = mini.get("key").getValue();
    if(key == ""){
    	 tree.clearFilter();
		 tree.collapseAll ();
    }else{
        key = key.toLowerCase();
        tree.filter(function (node) {
            var text = node.name ? node.name.toLowerCase() : "";
            tree.expandAll ();
            if (text.indexOf(key) != -1) {
                return true;
            }
        });
    }
}

controller

/**
	 * @title 地区树列表数据
	 * @author wangyu
	 * @data 2017-03-10
	 */

	public ModelAndView paramListByParentIdAndId(HttpServletRequest request,
			HttpServletResponse response) {
		List<Area> list = areaManager.getParamListByParentIdAndId();
		this.renderText(response, JSONArray.fromObject(list).toString());
		return null;
	}

manager

	
	/**
	 * 取对应的对象
	 * 
	 * @return
	 */
	public List<Area> getParamListByParentIdAndId() {
		Criteria criteria = this.getCriteria();
		return criteria.list();
	}

 

转载于:https://my.oschina.net/u/2991733/blog/881821

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值