1. Go to this page and download the library: Download orlac/yii2-sortable 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/ */
orlac / yii2-sortable example snippets
use orlac\sortable\UpAction;
use orlac\sortable\DownAction;
....
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
'up' => ['POST'],
'down' => ['POST'],
],
],
];
}
public function actions(){
return [
'up' => [
'class' => UpAction::className(),
'modelClass' => Model::className()
],
'down' => [
'class' => DownAction::className(),
'modelClass' => Model::className()
],
];
}
use orlac\sortable\ActionColumn;
Pjax::begin();
php
use orlac\sortable\SortableBehavior;
public function behaviors(){
return [
[
'class' => SortableBehavior::className(),
],
];
}
public function behaviors(){
return [
[
'class' => SortableBehavior::className(),
'scope' => function($model){
return Model::find()->addWere('...');
}
],
];
}
public function behaviors(){
return [
[
'class' => SortableBehavior::className(),
'scope' => function($model){
return Model::find()->addWere('...');
},
'sortColumn' => 'sort'
],
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.