Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#9701 closed feature (fixed)

Menu: Ability to prevent generation of dividers from items

Reported by: fnagel 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 3 years ago by scottgonzalez

  • Summary changed from Need a way in Menu to prevent empty items to be rendered as dividers to Menu: Ability to prevent generation of dividers from items
  • Version changed from git to 1.10.3

comment:2 Changed 3 years ago by jzaefferer

comment:3 Changed 3 years ago by fnagel

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 3 years ago by scottgonzalez

  • Milestone changed from none to 1.11.0
  • Priority changed from minor to blocker
  • Status changed from new to open

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 3 years ago by Felix Nagel

  • Resolution set to fixed
  • Status changed from open to closed

Menu: Add _isDivider method

Ability to prevent generation of dividers from items

Fixes #9701

Changeset: a6806ab17a9a5b332dc7d0c947a0a7a512dc2579

comment:6 Changed 3 years ago by Felix Nagel

Selectmenu: Fix empty option processing

Ref #9701

Changeset: 3dfa08f22753074ce8d873b68cdc1341161f70be

Note: See TracTickets for help on using tickets.