|
Lines 33-39
Link Here
|
| 33 |
"dojo/_base/lang", |
33 |
"dojo/_base/lang", |
| 34 |
"dojo/_base/array", |
34 |
"dojo/_base/array", |
| 35 |
"dojo/Deferred", |
35 |
"dojo/Deferred", |
| 36 |
"dojo/query", |
|
|
| 37 |
"dojo/dom-class", |
36 |
"dojo/dom-class", |
| 38 |
"dojox/grid/EnhancedGrid", |
37 |
"dojox/grid/EnhancedGrid", |
| 39 |
"../tools", |
38 |
"../tools", |
|
Lines 41-49
Link Here
|
| 41 |
"./_FormWidgetMixin", |
40 |
"./_FormWidgetMixin", |
| 42 |
"./StandbyMixin", |
41 |
"./StandbyMixin", |
| 43 |
"./_RegisterOnShowMixin", |
42 |
"./_RegisterOnShowMixin", |
|
|
43 |
"umc/i18n!", |
| 44 |
"dojox/grid/enhanced/plugins/IndirectSelection", |
44 |
"dojox/grid/enhanced/plugins/IndirectSelection", |
| 45 |
"dojox/grid/cells" |
45 |
"dojox/grid/cells" |
| 46 |
], function(declare, lang, array, Deferred, query, domClass, EnhancedGrid, tools, _SelectMixin, _FormWidgetMixin, StandbyMixin, _RegisterOnShowMixin) { |
46 |
], function(declare, lang, array, Deferred, domClass, EnhancedGrid, tools, _SelectMixin, _FormWidgetMixin, StandbyMixin, _RegisterOnShowMixin, _) { |
| 47 |
return declare("umc.widgets.MultiSelect", [ EnhancedGrid, _FormWidgetMixin, _SelectMixin, StandbyMixin, _RegisterOnShowMixin ], { |
47 |
return declare("umc.widgets.MultiSelect", [ EnhancedGrid, _FormWidgetMixin, _SelectMixin, StandbyMixin, _RegisterOnShowMixin ], { |
| 48 |
// summary: |
48 |
// summary: |
| 49 |
// This class represents a MultiSelect widget. Essentially, it adapts a DataGrid |
49 |
// This class represents a MultiSelect widget. Essentially, it adapts a DataGrid |
|
Lines 61-66
Link Here
|
| 61 |
// display the labe above the widget |
61 |
// display the labe above the widget |
| 62 |
labelPosition: 'top', |
62 |
labelPosition: 'top', |
| 63 |
|
63 |
|
|
|
64 |
// bool wether a header to select all entries should be shown |
| 65 |
showHeader: false, |
| 66 |
// label of select all entries header |
| 67 |
headerLabel: _('Select all'), |
| 68 |
|
| 64 |
// we need the plugin for selection via checkboxes |
69 |
// we need the plugin for selection via checkboxes |
| 65 |
plugins : { |
70 |
plugins : { |
| 66 |
indirectSelection: { |
71 |
indirectSelection: { |
|
Lines 71-83
Link Here
|
| 71 |
} |
76 |
} |
| 72 |
}, |
77 |
}, |
| 73 |
|
78 |
|
| 74 |
// simple grid structure, only one column |
|
|
| 75 |
structure: [{ |
| 76 |
field: 'label', |
| 77 |
name: 'Name', |
| 78 |
width: '100%' |
| 79 |
}], |
| 80 |
|
| 81 |
// the widget's class name as CSS class |
79 |
// the widget's class name as CSS class |
| 82 |
baseClass: EnhancedGrid.prototype.baseClass + ' umcMultiSelect', |
80 |
baseClass: EnhancedGrid.prototype.baseClass + ' umcMultiSelect', |
| 83 |
|
81 |
|
|
Lines 90-95
Link Here
|
| 90 |
|
88 |
|
| 91 |
this.inherited(arguments); |
89 |
this.inherited(arguments); |
| 92 |
|
90 |
|
|
|
91 |
// simple grid structure, only one column |
| 92 |
this.structure = [{ |
| 93 |
field: 'label', |
| 94 |
name: lang.replace('<b>{0}</b>', [this.headerLabel]), |
| 95 |
width: '100%' |
| 96 |
}]; |
| 97 |
|
| 93 |
// in case 'value' is not specified, generate a new array |
98 |
// in case 'value' is not specified, generate a new array |
| 94 |
if (!(this.value instanceof Array)) { |
99 |
if (!(this.value instanceof Array)) { |
| 95 |
this.value = []; |
100 |
this.value = []; |
|
Lines 99-106
Link Here
|
| 99 |
postCreate: function() { |
104 |
postCreate: function() { |
| 100 |
this.inherited(arguments); |
105 |
this.inherited(arguments); |
| 101 |
|
106 |
|
| 102 |
// hide the header |
107 |
// hide header if showHeader is false |
| 103 |
query('.dojoxGridHeader', this.domNode).style('height', '0px'); |
108 |
domClass.toggle(this.domNode, 'umcMultiSelectNoHeader', !this.showHeader); |
| 104 |
|
109 |
|
| 105 |
// send an onChange event when the selection has changed |
110 |
// send an onChange event when the selection has changed |
| 106 |
this.on('selectionChanged', lang.hitch(this, function() { |
111 |
this.on('selectionChanged', lang.hitch(this, function() { |
|
Lines 237-243
Link Here
|
| 237 |
// stop standby animation and re-render |
242 |
// stop standby animation and re-render |
| 238 |
this.standby(false); |
243 |
this.standby(false); |
| 239 |
this.render(); |
244 |
this.render(); |
| 240 |
} |
245 |
}, |
| 241 |
|
246 |
|
| 242 |
/*adaptHeight: function() { |
247 |
/*adaptHeight: function() { |
| 243 |
this.inherited(arguments); |
248 |
this.inherited(arguments); |
|
Lines 247-252
Link Here
|
| 247 |
this.scroller.windowHeight = parseInt(this.height, 10); |
252 |
this.scroller.windowHeight = parseInt(this.height, 10); |
| 248 |
} |
253 |
} |
| 249 |
}*/ |
254 |
}*/ |
|
|
255 |
|
| 256 |
render: function() { |
| 257 |
domClass.toggle(this.domNode, 'umcMultiSelectWithContent', this.get('rowCount')); |
| 258 |
this.inherited(arguments); |
| 259 |
} |
| 250 |
}); |
260 |
}); |
| 251 |
}); |
261 |
}); |
| 252 |
|
262 |
|