PHP code example of twixoff / yii2-sortable-grid-view-widget

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

    

twixoff / yii2-sortable-grid-view-widget example snippets


use himiklab\sortablegrid\SortableGridBehavior;

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

use himiklab\sortablegrid\SortableGridAction;

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