easyUI tree点击文字展开节点
2014-11-03 17:48
204 查看
easyUI默认展开树的时候,点击节点前边的黑色小三角 ,这样操作存在不人性化的地方,在实际使用中由于老旧电脑的存在和大龄使用者的眼花经常点不准;因此要实现点击节点名称展开的方式,其实就是在展开事件上加一个展开该节点的方法。
在onSelect事件中添加
$(this).tree('expand',node.target);
当选中该节点的时候,展开该节点下的节点,该方法只会展开下一级节点,并不会展开子节点下的节点。
如果要展开所有节点:
$(this).tree('expandAll',node.target);
给onclick绑定多个事件,如果部门有人,则在grid中显示人员,如果有子部门则展示下级部门
解决方案:
在onSelect事件中添加
$(this).tree('expand',node.target);
当选中该节点的时候,展开该节点下的节点,该方法只会展开下一级节点,并不会展开子节点下的节点。
如果要展开所有节点:
$(this).tree('expandAll',node.target);
$(document).ready(function(){ $('#dept').layout(); $('#deptTree').tree({ checkbox:false, url:'loadDeptJson.action?node=-1', onBeforeExpand:function(node,param){ $('#deptTree').tree('options').url="loadDeptJson.action?node="+node.id; }, onSelect:function(node){ $('#deptContent').load("viewDepartment.action?department.id="+node.id); $(this).tree('expand',node.target); }, }); });
给onclick绑定多个事件,如果部门有人,则在grid中显示人员,如果有子部门则展示下级部门
解决方案:
$("#dept_tree").tree({ url:"servlet/SearchServlet?dispatch=2&unit_id=" + unit_id+"&id=0", //此处的url是加载树 onBeforeExpand:function(node,param){ $("#dept_tree").tree("options").url="servlet/SearchServlet?dispatch=2&unit_id=" + unit_id+"&id="+node.id; }, onSelect:function(node){ $(this).tree("expand",node.target); //展开点击的文本的子节点 }, });
onClick:function(node){ //alert("id"+node.id+"部门id是:" + node.attributes.department_id+"--单位--"+node.attributes.unit_id); var url22 = "servlet/SearchServlet?dispatch=22&unit_id=" + node.attributes.unit_id; $.getJSON(url22,{department_id:node.attributes.department_id},function(data){ if(data.length == 0){ var url = "servlet/SearchServlet?dispatch=3&department_id="+node.attributes.department_id; $("#person_grid").datagrid({url:url,toolbar:results_grid_default_toolbar,columns:results_grid_default_columns}) } }); },
相关文章推荐
- easyUI tree点击文字展开节点
- easyui tree 点击文字展开节点
- easyUI tree点击文字展开节点
- easyUI tree点击文字展开节点
- easyUI tree点击文字展开节点
- asyUI tree点击文字展开节点
- easyui 点击文字展开和收缩节点
- Tree组件使用指南之五:点击树节点文字展开或收缩其子节点
- asp.net TreeView中点击父节点的文字,展开子节点
- vs2005 TreeView控件 根节点点击文字即展开
- 关于treeview控件怎样点击根节点的文字即可展开/收缩子节点【搜藏】
- asp.net 2.0 treeview点击相应的父节点文本展开子节点而不是点前面的加号才能打开
- Easyui tree 点击展开收缩
- 关于树标签的问题1-动静模式是,点击下级节点不能展开的问题
- jquery实现点击查看更多内容控制段落文字展开折叠效果
- easyui tree文本单击事件切换展开/折叠节点的状态
- ZTree树节点自动展开以及点击案例
- IOS点击文字展开滚轮实现,类似下拉列表
- asp.net 2.0 treeview点击相应的父节点文本展开子节点而不是点前面的加号才能打开
- EasyUI tree 实现点击展开/折叠