EasyUI Forum
September 14, 2025, 04:02:45 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: clear all menu items  (Read 9885 times)
jpierce
Jr. Member
**
Posts: 73


View Profile
« on: July 12, 2013, 07:49:35 AM »

I have a menu that I'm reusing (tied to a menubutton).  Each time the window comes up, I add a bunch of menu items (field names from the data that's showing, which may change).  The problem is that there is no "clear" or "removeAllItems" method for the menu.  It's rather clunky to have to keep my own list of items so I can call findItem and then removeItem.
Logged
jpierce
Jr. Member
**
Posts: 73


View Profile
« Reply #1 on: July 12, 2013, 08:00:23 AM »

FYI for anyone who is interested, what I wound up doing to avoid having to keep my own list is:

Code:
    var mm = $('#my_menu');
    $('.menu-text', mm)
            .map(function (i, e) {
                return e.textContent
            })
            .each(function (i, e) {
                mm.menu('removeItem', mm.menu('findItem', e).target)
            });

Would definitely remove a "clear"/"removeAllItems" method!
Logged
stollar
Newbie
*
Posts: 7


View Profile Email
« Reply #2 on: June 14, 2019, 11:18:12 AM »

I couldn't get this to work. Perhaps because I do not have menu-text in my page. Can you include a more complete example here please.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!