kv4nt/yii2repeater 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kv4nt/yii2repeater

最新稳定版本:v1.0.1

Composer 安装命令:

composer require kv4nt/yii2repeater

包简介

An interface to add and remove a repeatable group of input elements for yii2

README 文档

README

Repeater like http://briandetering.net/repeater

##How to use

install using composer: composer require kv4nt/yii2repeater

put this code in your form:

<?php echo Repeater::widget([
        'modelView' => '@app/modules/admin/views/***/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 related model | example: $model->items
    ]) ?>

in your desired controller ypu have to put tis code:

public function actions()
    {
        return [
            'add-item-action' => [
                'class' => 'kv4nt\yii2repeater\actions\AppendAction',
                'model' => 'app\models\Item',
                'contentPath' => '@app/modules/admin/views/***/repeater_view_file', //related to current controller
            ],
            'remove-item-action' => [
                'class' => 'kv4nt\yii2repeater\actions\DeleteAction',
                'model' => 'app\models\Item',
            ]
        ];
    }

And this is an example of the repeater_view_file.php reminded above:

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

统计信息

  • 总下载量: 403
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固