PHP code example of dimmitri / yii2-expand-row-column

1. Go to this page and download the library: Download dimmitri/yii2-expand-row-column library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dimmitri / yii2-expand-row-column example snippets




use dimmitri\grid\ExpandRowColumn;
use yii\grid\ActionColumn;
use yii\grid\GridView;
use yii\grid\SerialColumn;
use yii\helpers\Html;
use yii\helpers\Url;

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,
    ]);
}



use yii\grid\GridView;
use yii\widgets\Pjax;