Skip to content

Commit a19c8b0

Browse files
author
Korshenko, Olexii(okorshenko)
committed
Merge pull request #9 from magento-south/MAGETWO-43648
[South] Bugs
2 parents 6e70802 + f324fae commit a19c8b0

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Ui\Component\Form\Element;
8+
9+
class MultiSelect extends Select
10+
{
11+
const NAME = 'multiselect';
12+
13+
const DEFAULT_SIZE = 6;
14+
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function prepare()
19+
{
20+
$config['size'] = self::DEFAULT_SIZE;
21+
$this->setData('config', array_replace_recursive((array)$this->getData('config'), $config));
22+
parent::prepare();
23+
}
24+
}

app/code/Magento/Ui/view/base/ui_component/etc/definition.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
</item>
164164
</argument>
165165
</select>
166-
<multiselect class="Magento\Ui\Component\Form\Element\Select">
166+
<multiselect class="Magento\Ui\Component\Form\Element\MultiSelect">
167167
<argument name="data" xsi:type="array">
168168
<item name="template" xsi:type="string">ui/form/element/multiselect</item>
169169
<item name="js_config" xsi:type="array">
@@ -173,6 +173,9 @@
173173
<item name="elementTmpl" xsi:type="string">ui/form/element/multiselect</item>
174174
</item>
175175
</item>
176+
<item name="config" xsi:type="array">
177+
<item name="size" xsi:type="string">6</item>
178+
</item>
176179
</argument>
177180
</multiselect>
178181
<textarea class="Magento\Ui\Component\Form\Element\Textarea">

app/code/Magento/Ui/view/base/web/js/form/element/multiselect.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ define([
2020
*
2121
* @returns {Number|String}
2222
*/
23-
getInitialValue: function () {
24-
var value = this._super();
23+
normalizeData: function (value) {
24+
if (utils.isEmpty(value)) {
25+
value = [];
26+
}
2527

2628
return _.isString(value) ? value.split(',') : value;
2729
},

0 commit comments

Comments
 (0)