All Projects → unclead → Yii2 Multiple Input

unclead / Yii2 Multiple Input

Licence: bsd-3-clause
Yii2 widget for handle multiple inputs for an attribute of model

Labels

Projects that are alternatives of or similar to Yii2 Multiple Input

yii2-fullcalendar
Yii 2 component for easy fullcalendar integration
Stars: ✭ 21 (-94.17%)
Mutual labels:  yii2
Yii2 Migration
Yii 2 Migration Creator And Updater
Stars: ✭ 262 (-27.22%)
Mutual labels:  yii2
Yii2 Mongodb
Yii 2 MongoDB extension
Stars: ✭ 299 (-16.94%)
Mutual labels:  yii2
yii2-autocomplete-helper
Yii2 IDE Autocomplete Helper
Stars: ✭ 38 (-89.44%)
Mutual labels:  yii2
Yii2cmf
基于yii2的cmf管理系统
Stars: ✭ 255 (-29.17%)
Mutual labels:  yii2
Yii2 Gentelella
Free admin template for backend
Stars: ✭ 266 (-26.11%)
Mutual labels:  yii2
collection
Basic collection library for Yii Framework 2.0
Stars: ✭ 29 (-91.94%)
Mutual labels:  yii2
Economizzer
Open Source Personal Finance Manager
Stars: ✭ 348 (-3.33%)
Mutual labels:  yii2
Yii2 Advanced One Domain Config
A template configuration without separation on the frontend and backend parts on different domains.
Stars: ✭ 258 (-28.33%)
Mutual labels:  yii2
Yii2 Docker
Official Docker images suitable for Yii 2.0
Stars: ✭ 286 (-20.56%)
Mutual labels:  yii2
yii2-queuemanager
Yii2 Queue Manager (Analytic & Monitor)
Stars: ✭ 18 (-95%)
Mutual labels:  yii2
yii2-notification-wrapper
Yii2-notification-wrapper module renders a message from session flash (with ajax, pjax support and etc.) through Growl, Noty, Toastr and more libraries
Stars: ✭ 78 (-78.33%)
Mutual labels:  yii2
Yii2 Imagine
Yii 2 imagine extension
Stars: ✭ 271 (-24.72%)
Mutual labels:  yii2
yii2-rest-rbac
yii2 rbac yii2 rest RBAC Auth manager for Yii2 RESTful(YII2权限管理rbac--rest接口方式)
Stars: ✭ 79 (-78.06%)
Mutual labels:  yii2
Yii2 Swoole
yii2 swoole,让yii2运行在swoole上
Stars: ✭ 317 (-11.94%)
Mutual labels:  yii2
yii2-number
A number format mask control and input for Yii2 Framework
Stars: ✭ 22 (-93.89%)
Mutual labels:  yii2
Cors
🔮Supported(Laravel/Lumen/PSR-15/Swoft/Slim/ThinkPHP) - PHP CORS (Cross-origin resource sharing) middleware.
Stars: ✭ 266 (-26.11%)
Mutual labels:  yii2
Stacker
Stacker - The environment for local web development, ready for use.
Stars: ✭ 356 (-1.11%)
Mutual labels:  yii2
List
A curated list of awesome Yii Framework extensions, tutorials and other nice things
Stars: ✭ 344 (-4.44%)
Mutual labels:  yii2
Yii2support
Yii2 Support for PhpStorm / IntelliJ IDEA
Stars: ✭ 280 (-22.22%)
Mutual labels:  yii2

Yii2 Multiple input widget.

Yii2 widget for handle multiple inputs for an attribute of model and tabular input for batch of models.

Latest Stable Version Total Downloads Daily Downloads Latest Unstable Version License

Latest release

The latest stable version of the extension is v2.24.0 Follow the instruction for upgrading from previous versions

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require  unclead/yii2-multiple-input "~2.0"

or add

"unclead/yii2-multiple-input": "~2.0"

to the require section of your composer.json file.

Basic usage

Single column example

For example you want to have an ability of entering several emails of user on profile page. In this case you can use yii2-multiple-input widget like in the following code

use unclead\multipleinput\MultipleInput;

...

<?php
    echo $form->field($model, 'emails')->widget(MultipleInput::className(), [
        'max'               => 6,
        'min'               => 2, // should be at least 2 rows
        'allowEmptyList'    => false,
        'enableGuessTitle'  => true,
        'addButtonPosition' => MultipleInput::POS_HEADER, // show add button in the header
    ])
    ->label(false);
?>

See more in single column

Advanced usage

Multiple columns example

For example you want to have an interface for manage user schedule. For simplicity we will store the schedule in json string. In this case you can use yii2-multiple-input widget like in the following code

use unclead\multipleinput\MultipleInput;

...

<?= $form->field($model, 'schedule')->widget(MultipleInput::className(), [
    'max' => 4,
    'columns' => [
        [
            'name'  => 'user_id',
            'type'  => 'dropDownList',
            'title' => 'User',
            'defaultValue' => 1,
            'items' => [
                1 => 'User 1',
                2 => 'User 2'
            ]
        ],
        [
            'name'  => 'day',
            'type'  => \kartik\date\DatePicker::className(),
            'title' => 'Day',
            'value' => function($data) {
                return $data['day'];
            },
            'items' => [
                '0' => 'Saturday',
                '1' => 'Monday'
            ],
            'options' => [
                'pluginOptions' => [
                    'format' => 'dd.mm.yyyy',
                    'todayHighlight' => true
                ]
            ]
        ],
        [
            'name'  => 'priority',
            'title' => 'Priority',
            'enableError' => true,
            'options' => [
                'class' => 'input-priority'
            ]
        ]
    ]
 ]);
?>

See more in multiple columns

Clone filled rows

Clone button example

use unclead\multipleinput\MultipleInput;

...

<?= $form->field($model, 'products')->widget(MultipleInput::className(), [
    'max' => 10,
    'cloneButton' => true,
    'columns' => [
        [
            'name'  => 'product_id',
            'type'  => 'dropDownList',
            'title' => 'Special Products',
            'defaultValue' => 1,
            'items' => [
                1 => 'id: 1, price: $19.99, title: product1',
                2 => 'id: 2, price: $29.99, title: product2',
                3 => 'id: 3, price: $39.99, title: product3',
                4 => 'id: 4, price: $49.99, title: product4',
                5 => 'id: 5, price: $59.99, title: product5',
            ],
        ],
        [
            'name'  => 'time',
            'type'  => DateTimePicker::className(),
            'title' => 'due date',
            'defaultValue' => date('d-m-Y h:i')
        ],
        [
            'name'  => 'count',
            'title' => 'Count',
            'defaultValue' => 1,
            'enableError' => true,
            'options' => [
                'type' => 'number',
                'class' => 'input-priority',
            ]
        ]
    ]
])->label(false);

Using other icon libraries

Multiple input and Tabular input widgets now support FontAwesome and indeed any other icon library you chose to integrate to your project.

To take advantage of this, please proceed as follows:

  1. Include the preferred icon library into your project. If you wish to use fontAwesome, you can use the included FontAwesomeAsset which will integrate the free fa from their CDN;
  2. Add a mapping for your preferred icon library if its not in the iconMap array of the widget, like the following;
public $iconMap = [
    'glyphicons' => [
        'drag-handle' => 'glyphicon glyphicon-menu-hamburger',
        'remove' => 'glyphicon glyphicon-remove',
        'add' => 'glyphicon glyphicon-plus',
        'clone' => 'glyphicon glyphicon-duplicate',
    ],
    'fa' => [
        'drag-handle' => 'fa fa-bars',
        'remove' => 'fa fa-times',
        'add' => 'fa fa-plus',
        'clone' => 'fa fa-files-o',
    ],
    'my-amazing-icons' => [
        'drag-handle' => 'my my-bars',
        'remove' => 'my my-times',
        'add' => 'my my-plus',
        'clone' => 'my my-files',
    ]
];
  1. Set the preffered icon source
    public $iconSource = 'my-amazing-icons';

If you do none of the above, the default behavior which assumes you are using glyphicons is retained.

Documentation

You can find a full version of documentation in wiki

License

yii2-multiple-input is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].