rewrite method with only id parameter
This commit is contained in:
		
					parent
					
						
							
								5217718d7b
							
						
					
				
			
			
				commit
				
					
						4753ada7a9
					
				
			
		
					 1 changed files with 5 additions and 5 deletions
				
			
		|  | @ -189,14 +189,14 @@ Menu.prototype.closePopup = function (window) { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| Menu.prototype.getMenuItemById = function (items, id) { | ||||
|   if (items instanceof Menu) { | ||||
|     items = items.items | ||||
|   } | ||||
| Menu.prototype.getMenuItemById = function (id) { | ||||
|   let items = this; | ||||
|   if (items instanceof Menu) items = this.items | ||||
| 
 | ||||
|   let found = items.find(item => item.id === id) || false | ||||
|   for (let i = 0, length = items.length; !found && i < length; i++) { | ||||
|     if (items[i].submenu) { | ||||
|       found = this.getMenuItemById(items[i].submenu, id) | ||||
|       found = items[i].submenu.getMenuItemById(id) | ||||
|     } | ||||
|   } | ||||
|   return found | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Shelley Vohr
				Shelley Vohr