Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yii2mod/yii2-editable

Editable widget and column for gridview.
https://github.com/yii2mod/yii2-editable

yii2 yii2-editable yii2-editable-column yii2-editable-widget yii2-extension

Last synced: 3 days ago
JSON representation

Editable widget and column for gridview.

Awesome Lists containing this project

README

        





Yii2 Editable Widget



Renders a [X-Editable Input](http://vitalets.github.io/x-editable/index.html) allowing to use the amazing inline capabilities of [X-Editable Plugin](http://vitalets.github.io/x-editable/index.html).

[![Latest Stable Version](https://poser.pugx.org/yii2mod/yii2-editable/v/stable)](https://packagist.org/packages/yii2mod/yii2-editable) [![Total Downloads](https://poser.pugx.org/yii2mod/yii2-editable/downloads)](https://packagist.org/packages/yii2mod/yii2-editable) [![License](https://poser.pugx.org/yii2mod/yii2-editable/license)](https://packagist.org/packages/yii2mod/yii2-editable)
[![Build Status](https://travis-ci.org/yii2mod/yii2-editable.svg?branch=master)](https://travis-ci.org/yii2mod/yii2-editable)

Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

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:**
```php
[
'class' => EditableColumn::class,
'attribute' => 'username',
'url' => ['change-username'],
],
```
**Select column:**
```php
[
'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

2) And add to your controller
```php
public function actions()
{
return [
'change-username' => [
'class' => EditableAction::class,
'modelClass' => UserModel::class,
],
];
}
```
Usage Editable widget
---------------------------------

1) As a widget with a model

```php
\yii2mod\editable\Editable::widget([
'model' => $model,
'attribute' => 'firstName',
'url' => '/profile/update',
]);
```

2) With ActiveForm

```php
echo $form->field($model, "firstName")->widget(\yii2mod\editable\Editable::class, [
'url' => '/profile/update',
'mode' => 'popup',
]);
```

## Support us

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/yii2mod).
All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.