2017 © Pedro Peláez
 

yii2-extension yii2repeater

Repeater widget for yii2 tabular

image

relbraun/yii2repeater

Repeater widget for yii2 tabular

  • Sunday, August 20, 2017
  • by relbraun
  • Repository
  • 4 Watchers
  • 9 Stars
  • 84 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 20 % Grown

The README.md

yii2-repeater

An Yii2 widget enable you to implement Yii2 tabular with simple way., (*1)

How to use

install using composer: composer require relbraun/yii2repeater, (*2)

put this code in your form:, (*3)

<?php echo Repeater::widget([
        'modelView' => '@backend/views/path/to/your/repeater_view_file',
        'appendAction' => \yii\helpers\Url::to(['add-item-action']),
        'removeAction' => \yii\helpers\Url::to(['remove-item-action']),
        'form' => $form,
        'models' => $models, //The existing sub models
    ]) ?>

in your desired controller ypu have to put tis code:, (*4)

public function actions()
    {
        return [
            'add-item' => [
                'class' => 'relbraun\yii2repeater\actions\AppendAction',
                'model' => 'backend\models\DesiredModel',
                'contentPath' => '/path/to/repeater/view', //related to current controller
            ],
            'remove-item' => [
                'class' => 'relbraun\yii2repeater\actions\DeleteAction',
                'model' => 'backend\models\DesiredModel',
            ]
        ];
    }

And this is an example of the repeater_view_file.php reminded above:, (*5)

<div class="repeater-content">
    <div class="form-group">
        <?= Html::label('Some label', Html::getInputId($model, "[$k]attribute")) ?>
        <?= Html::activeTextInput($model, "[$k]attribute", ['class' => 'form-control']) ?>
    </div>
    <div class="form-group">
        <?= Html::label('Other label', Html::getInputId($model, "[$k]other_attribute")) ?>
        <?= Html::activeTextInput($model, "[$k]other_attribute", ['class' => 'form-control']) ?>
    </div>
</div>

The Versions

20/08 2017

dev-master

9999999-dev https://github.com/relbraun/yii2-repeater

Repeater widget for yii2 tabular

  Sources   Download

MIT

The Requires

 

20/08 2017

1.0.1

1.0.1.0 https://github.com/relbraun/yii2-repeater

Repeater widget for yii2 tabular

  Sources   Download

MIT

The Requires

 

19/12 2016

1.0.0

1.0.0.0 https://github.com/relbraun/yii2-repeater

Repeater widget for yii2 tabular

  Sources   Download

MIT

The Requires

 

01/12 2016

0.1.0

0.1.0.0 https://github.com/relbraun/yii2-repeater

Repeater widget for yii2 tabular

  Sources   Download

MIT

The Requires