Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/yii2mod/yii2-editable
- Owner: yii2mod
- License: mit
- Created: 2014-11-29T21:19:28.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-01-04T17:21:46.000Z (almost 5 years ago)
- Last Synced: 2024-10-30T01:58:32.550Z (17 days ago)
- Topics: yii2, yii2-editable, yii2-editable-column, yii2-editable-widget, yii2-extension
- Language: PHP
- Homepage:
- Size: 190 KB
- Stars: 54
- Watchers: 10
- Forks: 14
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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, datetime2) 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.