refactor GridView helpers
This commit is contained in:
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
|
||||
class DepartmentGrid extends CommonGrid {
|
||||
|
||||
public static function pid($departmentArray) {
|
||||
@@ -13,24 +10,4 @@ class DepartmentGrid extends CommonGrid {
|
||||
};
|
||||
}
|
||||
|
||||
public static function checkbox() {
|
||||
return function($model) {
|
||||
if ($model->id == 1)
|
||||
return "";
|
||||
return "<input type='checkbox' value='{$model->id}' name='checkbox-department' class='checkbox-department'>";
|
||||
};
|
||||
}
|
||||
|
||||
public static function rows() {
|
||||
return function($model, $index, $widget, $grid) {
|
||||
return [
|
||||
"onclick" => "common.form(this, 'department');",
|
||||
"style" => "cursor: pointer;",
|
||||
"data" => [
|
||||
"href" => Url::to(["update", "id" => $model->id])
|
||||
]
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user