@@ -261,7 +261,7 @@ Use the following code for this purpose:
261
261
[
262
262
'name' => 'title',
263
263
'title' => 'Title',
264
- 'type' => \unclead\widgets\MultipleInputColumn ::TYPE_TEXT_INPUT,
264
+ 'type' => TabularInputColumn ::TYPE_TEXT_INPUT,
265
265
],
266
266
[
267
267
'name' => 'description',
@@ -366,6 +366,51 @@ Assume you want to load a widget via ajax and then show it inside modal window.
366
366
367
367
You can fina an example of usage in a discussion of [ issue] ( https://github.com/unclead/yii2-multiple-input/issues/58 )
368
368
369
+ ### Using of a placeholder {multiple_index}
370
+
371
+ You can use a placeholder {multiple index} in a widget configuration, e.g. for implementation of dependent drop down lists.
372
+
373
+ ``` php
374
+ <?= $form->field($model, 'field')->widget(MultipleInput::className(), [
375
+ 'allowEmptyList' => false,
376
+ 'rowOptions' => [
377
+ 'id' => 'row{multiple_index}',
378
+ ],
379
+ 'columns' => [
380
+ [
381
+ 'name' => 'category',
382
+ 'type' => 'dropDownList',
383
+ 'title' => 'Category',
384
+ 'defaultValue' => '1',
385
+ 'items' => [
386
+ '1' => 'Test 1',
387
+ '2' => 'Test 2',
388
+ '3' => 'Test 3',
389
+ '4' => 'Test 4',
390
+ ],
391
+ 'options' => [
392
+ 'onchange' => <<< JS
393
+ $.post("list?id=" + $(this).val(), function(data){
394
+ console.log(data);
395
+ $("select#subcat-{multiple_index}").html(data);
396
+ });
397
+ JS
398
+ ],
399
+ ],
400
+ [
401
+ 'name' => 'subcategory',
402
+ 'type' => 'dropDownList',
403
+ 'title' => 'Subcategory',
404
+ 'items' => [],
405
+ 'options'=> [
406
+ 'id' => 'subcat-{multiple_index}'
407
+ ],
408
+ ],
409
+ ]
410
+ ]);
411
+ ?>
412
+ ```
413
+
369
414
## JavaScript events
370
415
This widget has following events:
371
416
- ` afterInit ` : triggered after initialization
0 commit comments