|
5 | 5 | use unclead\multipleinput\examples\models\ExampleModel; |
6 | 6 | use yii\helpers\Html; |
7 | 7 | use unclead\multipleinput\MultipleInputColumn; |
8 | | -use yii\widgets\MaskedInput; |
9 | 8 |
|
10 | 9 | // Note: You have to install https://github.com/kartik-v/yii2-widget-datepicker for correct work an example |
11 | 10 | use kartik\date\DatePicker; |
|
24 | 23 |
|
25 | 24 | <h3>Single column</h3> |
26 | 25 | <?php |
27 | | -// echo $form->field($model, 'emails')->widget(MultipleInput::className(), [ |
28 | | -// 'max' => 6, |
29 | | -// 'allowEmptyList' => false, |
30 | | -// 'columns' => [ |
31 | | -// [ |
32 | | -// 'name' => 'emails', |
33 | | -// 'options' => [ |
34 | | -// 'placeholder' => 'E-mail' |
35 | | -// ] |
36 | | -// ] |
37 | | -// ], |
38 | | -// 'min' => 2, // should be at least 2 rows |
39 | | -// 'addButtonPosition' => [ |
40 | | -// MultipleInput::POS_HEADER, |
41 | | -// MultipleInput::POS_FOOTER, |
42 | | -// MultipleInput::POS_ROW |
43 | | -// ] |
44 | | -// ]) |
45 | | -// ->label(false); |
| 26 | + echo $form->field($model, 'emails')->widget(MultipleInput::className(), [ |
| 27 | + 'max' => 6, |
| 28 | + 'allowEmptyList' => false, |
| 29 | + 'columns' => [ |
| 30 | + [ |
| 31 | + 'name' => 'emails', |
| 32 | + 'options' => [ |
| 33 | + 'placeholder' => 'E-mail' |
| 34 | + ] |
| 35 | + ] |
| 36 | + ], |
| 37 | + 'min' => 2, // should be at least 2 rows |
| 38 | + 'addButtonPosition' => [ |
| 39 | + MultipleInput::POS_HEADER, |
| 40 | + MultipleInput::POS_FOOTER, |
| 41 | + MultipleInput::POS_ROW |
| 42 | + ] |
| 43 | + ]) |
| 44 | + ->label(false); |
46 | 45 | ?> |
47 | 46 |
|
48 | 47 | <h3>Multiple columns</h3> |
|
89 | 88 | ], |
90 | 89 | [ |
91 | 90 | 'name' => 'day', |
92 | | - 'type' => MaskedInput::className(), |
| 91 | + 'type' => DatePicker::className(), |
93 | 92 | 'title' => 'Day', |
94 | 93 | 'value' => function($data) { |
95 | 94 | return $data['day']; |
|
99 | 98 | '1' => 'Monday' |
100 | 99 | ], |
101 | 100 | 'options' => [ |
102 | | - 'mask' => '99.99.9999' |
103 | | - |
| 101 | + 'pluginOptions' => [ |
| 102 | + 'format' => 'dd.mm.yyyy', |
| 103 | + 'todayHighlight' => true |
| 104 | + ] |
104 | 105 | ], |
105 | | -// 'options' => [ |
106 | | -// 'pluginOptions' => [ |
107 | | -// 'format' => 'dd.mm.yyyy', |
108 | | -// 'todayHighlight' => true |
109 | | -// ] |
110 | | -// ], |
111 | 106 | 'headerOptions' => [ |
112 | 107 | 'style' => 'width: 250px;', |
113 | 108 | 'class' => 'day-css-class' |
|
164 | 159 | console.log('calls on after initialization event'); |
165 | 160 | }).on('beforeAddRow', function(e) { |
166 | 161 | console.log('calls on before add row event'); |
167 | | - }).on('afterAddRow', function(e) { |
168 | | - console.log('calls on after add row event'); |
| 162 | + }).on('afterAddRow', function(e, row) { |
| 163 | + console.log('calls on after add row event', $(row)); |
169 | 164 | }).on('beforeDeleteRow', function(e, item){ |
170 | 165 | console.log(item); |
171 | 166 | console.log('calls on before remove row event'); |
|
0 commit comments