blob: 3bd14067eb3c83746902d9016562fcb1468e8217 [file] [log] [blame]
Akron6bb71582016-06-10 20:41:08 +02001define(['menu/item'], function (itemClass) {
2 /**
3 * Menu item for select menus.
4 */
Akron6bb71582016-06-10 20:41:08 +02005 return {
6
7 /**
8 * Create new menu item
9 * for tree views.
10 */
11 create : function (params) {
12 return Object.create(itemClass)
Akronaba7a5a2016-08-15 21:58:33 +020013 .upgradeTo(this)._init(params);
Akron6bb71582016-06-10 20:41:08 +020014 },
15
Akron0b489ad2018-02-02 16:49:32 +010016
Akron6bb71582016-06-10 20:41:08 +020017 /**
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
Akron0b489ad2018-02-02 16:49:32 +010029
30 /**
31 * Get title of item.
32 */
Akron6bb71582016-06-10 20:41:08 +020033 title : function () {
34 return this.content().textContent;
35 }
36 };
37});