PHP code example of futuretek / yii2-grid

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

    

futuretek / yii2-grid example snippets


\futuretek\grid\GridView::widget(['dataProvider' => $dataProvider])

use himiklab\sortablegrid\SortableGridBehavior;

public function behaviors()
{
    return [
        'sort' => [
            'class' => SortableGridBehavior::className(),
            'sortableAttribute' => 'position'
        ],
    ];
}

use himiklab\sortablegrid\SortableGridAction;

public function actions()
{
    return [
        'sort' => [
            'class' => SortableGridAction::className(),
            'modelName' => Model::className(),
        ],
    ];
}

\futuretek\grid\GridView::widget([
    'sortable' => true, 
    'sortableAction' => 'sortMyGridBitch'
]);