Ticket #9701 (closed feature: fixed)

Opened 4 months ago

Last modified 4 months ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 months ago by scott.gonzalez

  • Version changed from git to 1.10.3
  • 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

comment:2 Changed 4 months ago by joern.zaefferer

comment:3 Changed 4 months 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 4 months ago by scott.gonzalez

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

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 4 months ago by Felix Nagel

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

Menu: Add _isDivider method

Ability to prevent generation of dividers from items

Fixes #9701

Changeset: a6806ab17a9a5b332dc7d0c947a0a7a512dc2579

comment:6 Changed 4 months ago by Felix Nagel

Selectmenu: Fix empty option processing

Ref #9701

Changeset: 3dfa08f22753074ce8d873b68cdc1341161f70be

Note: See TracTickets for help on using tickets.