dimmitri/yii2-expand-row-column
Composer 安装命令:
composer require dimmitri/yii2-expand-row-column
包简介
Expand row column for the Yii 2.0 GridView widget.
README 文档
README
Displays a clickable column that will make an ajax request and display its resulting data into a new row.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist dimmitri/yii2-expand-row-column "*"
or add
"dimmitri/yii2-expand-row-column": "*"
to the require section of your composer.json file.
Usage
Prior to version 1.0.5, the 'column_id' property was generated automatically. In version 1.0.5, it is now possible to assign the 'column_id' property. Assigning the 'column_id' property is optional, but recommended.
view/index.php:
<?php use dimmitri\grid\ExpandRowColumn; use yii\grid\ActionColumn; use yii\grid\GridView; use yii\grid\SerialColumn; use yii\helpers\Html; use yii\helpers\Url; ?> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => SerialColumn::class], // simple example [ 'class' => ExpandRowColumn::class, 'attribute' => 'name', 'column_id' => 'column-info', 'url' => Url::to(['info']), ], // advanced example [ 'class' => ExpandRowColumn::class, 'attribute' => 'status_id', 'column_id' => 'column-status', 'ajaxErrorMessage' => 'Oops', 'ajaxMethod' => 'GET', 'url' => Url::to(['detail']), 'submitData' => function ($model, $key, $index) { return ['id' => $model->status_id, 'advanced' => true]; }, 'enableCache' => false, 'afterValue' => function ($model, $key, $index) { return ' ' . Html::a( Html::tag('span', '', ['class' => 'glyphicon glyphicon-download', 'aria-hidden' => 'true']), ['csv', 'ref' => $model->status_id], ['title' => 'Download event history in csv format.'] ); }, 'format' => 'raw', 'expandableOptions' => [ 'title' => 'Click me!', 'class' => 'my-expand', ], 'contentOptions' => [ 'style' => 'display: flex; justify-content: space-between;', ], ], ['class' => ActionColumn::class], ], ]) ?>
Actions:
public function actionIndex() { $searchModel = new ModelSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); // The key (or keyField) must be filled, if the key is not equal to primary key. $dataProvider->key = 'uuid';// for ActiveDataProvider // $dataProvider->keyField = 'uuid';// for ArrayDataProvider return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } public function actionDetail($id, $advanced = false) { $model = $this->findModel($id); $dataProvider = new ArrayDataProvider([ 'allModels' => $model->events, ]); return $this->renderAjax('_detail', [ 'dataProvider' => $dataProvider, 'advanced' => $advanced, 'id' => $id, ]); }
view/_detail.php:
<?php use yii\grid\GridView; use yii\widgets\Pjax; ?> <?php Pjax::begin(['id' => "pjax-{$id}", 'enablePushState' => false]); ?> <?= GridView::widget([ // .... ]) ?> <?php Pjax::end(); ?>
dimmitri/yii2-expand-row-column 适用场景与选型建议
dimmitri/yii2-expand-row-column 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.15k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 06 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「grid」 「widget」 「yii2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dimmitri/yii2-expand-row-column 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dimmitri/yii2-expand-row-column 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dimmitri/yii2-expand-row-column 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table.
Plug-ins for DataTables
A custom URL rule class for Yii 2 which allows to create translated URL rules
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
TYPO3 extension providing content elements powered by gridelements and bootstrap. Available elements: container, columns, tabs, accordion, tile unit and card.
Add a weather widget to Flarum
统计信息
- 总下载量: 13.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-16
