排名
6
文章
199
粉丝
4
评论
3
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256


欢迎加群交流技术

自定义右键菜单:
重写contextmenu即可,把他放到contextmenu中
$("#你的树形id").jstree({
contextmenu:{
}
});
代码如下:
- "contextmenu": {
- items: {
- add: {
- "label": "新增分组",
- "action": function (data) {
- var inst = jQuery.jstree.reference(data.reference);
- obj = inst.get_node(data.reference);
- layer.open({
- type: 2,
- title: '新增[' + obj.text + ']的子组',
- shadeClose: true,
- area: ['380px', '300px'],
- content: '/admin/Group/add/id/' + obj.id //iframe的url
- });
- }
- }
- ,
- "edit": {
- "label": "修改分组",
- "action": function (data) {
- var inst = jQuery.jstree.reference(data.reference);
- var obj = inst.get_node(data.reference);
- var type = obj.id.substr(0, 4);
- if (type == 'root') {
- layer.msg('根节点无法修改', { 'time': 2000, 'icon': 2 });
- return;
- }
- if (type == 'list') {
- layer.msg('考核对象分组请在系统设置-指标分组权限列表中修改', { 'icon': 2 });
- return;
- }
- layer.open({
- type: 2,
- title: '修改[' + obj.text + ']的子组',
- shadeClose: true,
- shade: 0.8,
- area: ['380px', '300px'],
- content: '/admin/Group/edit/id/' + obj.id //iframe的url
- });
- }
- },
- "del": {
- "label": "删除分组",
- "action": function (data) {
- console.log(data);
- }
- }
- }
- }
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739。有需要软件开发,或者学习软件技术的朋友可以和我联系~(Q:815170684)
评价