Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9701 closed feature (fixed)

Menu: Ability to prevent generation of dividers from items

Reported by: Felix Nagel Owned by:
Priority: blocker Milestone: 1.11.0
Component: ui.menu Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

In Selectmenu we need a way to show empty options. Currently the empty items (li elememts rendered by Selectmenu widget) will be processed as dividers. Any ideas how to solve this?

Please see Selectmenu visual test for a demo.

Change History (7)

comment:1 Changed 9 years ago by Scott González

Summary: Need a way in Menu to prevent empty items to be rendered as dividersMenu: Ability to prevent generation of dividers from items
Version: git1.10.3

comment:2 Changed 9 years ago by Jörn Zaefferer

comment:3 Changed 9 years ago by Felix Nagel

I played a little with this and it's possible to display an empty option by adding a special "empty" class and exclude this by using options.items. It's similar to adding "ui-menu-item" class to empty options: the empty items will be displayed but not processed (no generated id, ...).

These are the relevant lines: https://github.com/jquery/jquery-ui/blob/bc8e75059c7a222ede8f5fddd88098581e5ee3ce/ui/jquery.ui.menu.js#L307-L316

comment:4 Changed 9 years ago by Scott González

Milestone: none1.11.0
Priority: minorblocker
Status: newopen

Let's move https://github.com/jquery/jquery-ui/blob/bc8e75059c7a222ede8f5fddd88098581e5ee3ce/ui/jquery.ui.menu.js#L313 into a method named _isDivider() so that it can be overridden.

We'll also need to document this as an extension point for 1.11.

comment:5 Changed 9 years ago by Felix Nagel

Resolution: fixed
Status: openclosed

Menu: Add _isDivider method

Ability to prevent generation of dividers from items

Fixes #9701

Changeset: a6806ab17a9a5b332dc7d0c947a0a7a512dc2579

comment:6 Changed 9 years ago by Felix Nagel

Selectmenu: Fix empty option processing

Ref #9701

Changeset: 3dfa08f22753074ce8d873b68cdc1341161f70be

Note: See TracTickets for help on using tickets.