Skip to content
Editable widget and column for gridview.
Branch: master
Clone or download
Latest commit 7263315 Aug 1, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
bundles fix code style Nov 22, 2016
.gitattributes added .travis.yml Jan 1, 2017
.gitignore added .travis.yml Jan 1, 2017
.php_cs update php_cs Jan 15, 2018
.travis.yml update README Aug 16, 2017
Editable.php Update Editable.php Jan 15, 2018
EditableAction.php
EditableColumn.php
LICENSE.md LICENSE INFORMATION Jun 17, 2015
README.md
composer.json update README Aug 16, 2017

README.md

Yii2 Editable Widget


Renders a X-Editable Input allowing to use the amazing inline capabilities of X-Editable Plugin.

Latest Stable Version Total Downloads License Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2mod/yii2-editable "*"

or add

"yii2mod/yii2-editable": "*"

to the require section of your composer.json.

Usage Editable column

  1. In your gridview columns section

Text column:

 [
    'class' => EditableColumn::class,
    'attribute' => 'username',
    'url' => ['change-username'],
 ],

Select column:

[
    'class' => EditableColumn::class,
    'attribute' => 'status',
    'url' => ['change-username'],
    'type' => 'select',
    'editableOptions' => function ($model) {
        return [
            'source' => [1 => 'Active', 2 => 'Deleted'],
            'value' => $model->status,
        ];
    },
],

Allowed column types: text, select, address, combodate, date, datetime

  1. And add to your controller
public function actions()
{
    return [
        'change-username' => [
            'class' => EditableAction::class,
            'modelClass' => UserModel::class,
        ],
    ];
}

Usage Editable widget

  1. As a widget with a model
\yii2mod\editable\Editable::widget([
    'model' => $model,
    'attribute' => 'firstName',
    'url' => '/profile/update',
]);
  1. With ActiveForm
echo $form->field($model, "firstName")->widget(\yii2mod\editable\Editable::class, [
    'url' => '/profile/update',
    'mode' => 'popup',
]);
You can’t perform that action at this time.