如何禁用 Wijmo 菜单项?
是否可以禁用 Wijmo 菜单项?
我有以下 fiddle,并且我想禁用菜单选项(分支或分支) leaf) 如果用户没有特定的权限。我尝试将节点的
和
标记设置为具有 disabled
属性。我尝试设置 disabled='disabled'
和 disabled='true'
和 disabled=true
,但无法获取菜单项禁用。菜单组件的 API 似乎没有禁用某个项目的方法,因此我假设我只会禁用 DOM 中的元素。
在我的小提琴中,有一个叶子(政治——第一个父级突发新闻下的第二个节点)有一个与之关联的 URL。我希望能够禁用此项目。
是否可以禁用 Wijmo 菜单项?如果是这样,怎么办?
先感谢您!
Is it possible to disable a Wijmo menu item?
I have the following fiddle, and I'd like to disable a menu option (either a branch or a leaf) if the user doesn't have a certain permission. I've tried setting the <li>
and the <a>
tags of the node to have the disabled
attribute. I've tried setting disabled='disabled'
and disabled='true'
and disabled=true
, but can't get the menu item to disable.
The API for the menu component doesn't seem to have a method to disable an item, so I'm assuming I would just disable the element in the DOM.
In my fiddle, there is a leaf (Politics -- the second node under the first parent Breaking News) that has a URL associated to it. I'd like to be able to disable this item.
Is it possible to disable a Wijmo menu item? If so, how?
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们在根菜单中添加了一个禁用选项。我认为这不是你想要的。我只会做类似于凯文的建议的事情,但仍然使用禁用的属性。像这样:
您还可以添加一些 CSS 使其看起来已禁用。这是更新的小提琴: http://jsfiddle.net/3CQGC/3/
We have a disable option added to the root menu. I don't think that is what you want though. I would just do soemthing similar to Kevin's recommendation, but still use the disabled attr. Like so:
You can also add a little CSS to make it look disabled. Here is the updated fiddle: http://jsfiddle.net/3CQGC/3/
为什么你不能不显示你想要禁用的分支或叶子?
菜单上的所有项目都是超链接,因此您无法禁用它们。
或者有一个技巧:
确保当您单击链接时该链接不会执行任何操作。
Why can't you just not display the branch or leaf you'd like to disable?
All the items on the menu are hyperlinks, so you can't disable them.
OR there is the trick of:
to make sure the link does nothing when you click on it.