PHP code example of martynchuk / yii2-editable-cell

1. Go to this page and download the library: Download martynchuk/yii2-editable-cell 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/ */

    

martynchuk / yii2-editable-cell example snippets


use martynchuk\editablecell\EditableColumn;

echo GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        'id',
        [
            'class' => EditableColumn::class,
            'attribute' => 'name',
            'editableUrl' => ['site/editable'],
        ],
        'email',
    ],
]);

[
    'class' => EditableColumn::class,
    'attribute' => 'status',
    'editableType' => 'select', // text, textarea, select, date, number
    'editableUrl' => ['user/update-status'],
    'editableOptions' => [
        'items' => [
            ['value' => 1, 'label' => 'Active'],
            ['value' => 0, 'label' => 'Inactive'],
        ],
    ],
    'primaryKey' => 'id',
    'pjaxContainer' => '#grid-pjax', // Pjax container selector to reload after save
    'afterSave' => 'onStatusUpdated', // JavaScript callback
    'onError' => 'onUpdateError', // JavaScript callback
]

use martynchuk\editablecell\EditableHelper;

public function actionEditable()
{
    return EditableHelper::process(Articles::class);
}

yii2-editable-cell/
├── assets/
│   ├── css/
│   │   └── editable-cell.css
│   └── js/
│       └── editable-cell.js
├── src/
│   ├── Bootstrap.php
│   ├── EditableCellAsset.php
│   ├── EditableColumn.php
│   └── EditableHelper.php
├── tests/
├── composer.json
├── LICENSE
└── README.md