jQuery UI Widgets › Forums › General Discussions › jqxMenu – disable menu items, but show all sub menus
Tagged: JavaScript Menu, jQuery Menu, jqwidgets menu, jqx menu, Menu
This topic contains 7 replies, has 2 voices, and was last updated by Hristo 7 years, 1 month ago.
-
Author
-
Hi,
I would like to be able to set a menu item as disabled, and have it greyed out, and yet at the same time display all the child menu items as also disabled.
I notice that when a menu item is disabled, none of the child menu items are displayed.
Is it possible for me to be able to do this somehow?
I appreciate your help.
Kind regards,
Polly
Hello Polly,
I would like to suggest you look at this topic:
http://www.jqwidgets.com/community/topic/disable-menu-item/#post-2154Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi Hristo,
thank you for your reply and the link.
What I would like to do is to show all the sub menus even when the top menu item is disabled.
The present behaviour disables the top menu item and hides all the sub-menus.
I look forward to your reply
Kind regards,
Polly
Hello Polly,
You could bind to itemclick event and a check is this the item of the menu that you do not want to open then after click you should use
closeItem
method of the jqxMenu on that item.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi Hristo,
Thank you for your reply and the suggestion.
I would like to show which items are set as disabled, and I thought I would do this by attaching a CSS class name (e.g. isDisabled) to the particular list item that I wanted to set as disabled. This class would set the menu list item with a different background colour.
But I see that this class name is ignored when the jqxMenu is created, which uses its own classes. Is there any way you would suggest that I iterate through all the menu items and add my own isDisabled CSS class to your classes?
That way, when the user views the menu, they could instantly see which menu items are disabled, as these would have a different colour. Then when the user clicked the menu item I would use your itemClick event that you suggested, to make sure that the href was disabled.
Can you suggest how I can add my CSS class to just the list items I wanted to show as disabled?
Thank you for your time.
Kind regards,
Polly
Hello Polly,
Unfortunately, there is no such option with ‘classes’ but you could set different IDs for each one. After that, you can set the desired style.
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi Hristo, thank you for your reply. Yes the Id does work if I put it on the <li>. However, is it possible to add a class to a jqxWidget Menu item on the fly after it has been created? I see that the menu items have a list of auto generated classes, but I would need to access this and add my class at the end. Do you have any suggestions how this could be achieved programmatically? Thank you for your help. Kind regards, Polly</li>
Hello Polly,
As I mentioned there is no such functionality to implement additional classes to that widget.
I would like to suggest you again the approach with the IDs that I mentioned before.
If you want to change the style of the items or when they are ‘hovered’ I would suggest you look at the “Styling and Appearance” section:
http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxmenu/jquery-menu-styling-and-appearance.htm?search=menuBest Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.