Akron | 6bb7158 | 2016-06-10 20:41:08 +0200 | [diff] [blame] | 1 | define(['menu/item'], function (itemClass) { |
| 2 | /** |
| 3 | * Menu item for select menus. |
| 4 | */ |
| 5 | |
| 6 | return { |
| 7 | |
| 8 | /** |
| 9 | * Create new menu item |
| 10 | * for tree views. |
| 11 | */ |
| 12 | create : function (params) { |
| 13 | return Object.create(itemClass) |
Akron | aba7a5a | 2016-08-15 21:58:33 +0200 | [diff] [blame] | 14 | .upgradeTo(this)._init(params); |
Akron | 6bb7158 | 2016-06-10 20:41:08 +0200 | [diff] [blame] | 15 | }, |
| 16 | |
| 17 | /** |
| 18 | * Override click action of the menu item. |
| 19 | */ |
| 20 | onclick : function (e) { |
| 21 | var menu = this.menu(); |
| 22 | menu.hide(); |
| 23 | // Index was set on initialization |
| 24 | menu.select(this._index); |
| 25 | menu.showTitle(); |
| 26 | e.halt(); |
| 27 | }, |
| 28 | |
| 29 | title : function () { |
| 30 | return this.content().textContent; |
| 31 | } |
| 32 | }; |
| 33 | }); |