我如何在相同级别的TreeView中限制重复名称 [英] How i can restrict duplicate names in treeview same level

查看:118
本文介绍了我如何在相同级别的TreeView中限制重复名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hai,
在我的项目中,我使用了javascript动态树视图和上下文菜单,其中包含菜单项ADD,EDIT,DELETE.
所有操作符都只能正常运行,但我想将重复名称限制在同一级别的
树状视图,显示它在同一级别中需要重复的值,
如何限制重复的名称,
如果你知道帮我..
谢谢与问候.
Honey

hai,
In my prj, i used a javascript dynamic treeview, and context menu with menu items ADD,EDIT,DELETE.
All opertaions are working good only but i want to restrict duplicate names in the same level of
the treeview, present it takes duplicate values in the same level,
How can i restrict that duplicate names,,
If u know help me..
thanks & Regards.
Honey

推荐答案

由于您说的是基于Javascript的客户端树状视图,因此我可以放心地假设操作(添加,编辑,删除)可以在客户端站点上处理也(操作的至少一部分).

现在,在添加/编辑节点时,您需要使用Javascript将所有节点置于同一级别.将其存储在数组中以供以后比较或直接比较同一个名称.如果发现已经存在相同的名称,则不要继续操作并向用户显示有效的消息/提示.
Since you said it''s Javascript based client side treeview, I can safely assume the operations(Add, Edit, Delete) can be handled on client site too (atleast part of operation).

Now, at the time of adding/editing a node, you need to get all the nodes at the same level using Javascript. Store it in an array to compare later or directly compare for same name. If you find same name already existing then don''t continue the operation and show the valid message/prompt to the user.


这篇关于我如何在相同级别的TreeView中限制重复名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆