8cbecc56c0614c4b482948f20bc0eb3e3a8cd5e1
[ccsdk/features.git] / sdnr / wt / devicemanager / provider / src / main / resources / elasticsearch / plugins / head / src / app / ui / selectMenuPanel / selectMenuPanel.js
1 (function( app ) {
2
3         var ui = app.ns("ui");
4
5         ui.SelectMenuPanel = ui.MenuPanel.extend({
6                 defaults: {
7                         items: [],              // (required) an array of menu items
8                         value: null
9                 },
10                 _baseCls: "uiSelectMenuPanel uiMenuPanel",
11                 init: function() {
12                         this.value = this.config.value;
13                         this._super();
14                 },
15                 _getItems: function() {
16                         return this.config.items.map( function( item ) {
17                                 return {
18                                         text: item.text,
19                                         selected: this.value === item.value,
20                                         onclick: function( jEv ) {
21                                                 var el = $( jEv.target ).closest("LI");
22                                                 el.parent().children().removeClass("selected");
23                                                 el.addClass("selected");
24                                                 this.fire( "select", this, { value: item.value } );
25                                                 this.value = item.value;
26                                         }.bind(this)
27                                 };
28                         }, this );
29
30                 }
31         });
32
33 })( this.app );