yii2mod/yii2-editable
最新稳定版本:1.5
Composer 安装命令:
composer require yii2mod/yii2-editable
包简介
Yii2 editable field extension
README 文档
README
Yii2 Editable Widget
Renders a X-Editable Input allowing to use the amazing inline capabilities of X-Editable Plugin.
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
- 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
- And add to your controller
public function actions() { return [ 'change-username' => [ 'class' => EditableAction::class, 'modelClass' => UserModel::class, ], ]; }
Usage Editable widget
- As a widget with a model
\yii2mod\editable\Editable::widget([ 'model' => $model, 'attribute' => 'firstName', 'url' => '/profile/update', ]);
- With ActiveForm
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. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.
统计信息
- 总下载量: 377.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 55
- 点击次数: 1
- 依赖项目数: 13
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-01