refactor GridView helpers

This commit is contained in:
2020-10-08 17:25:53 +07:00
parent 0273aa2179
commit 31675d0a28
12 changed files with 43 additions and 232 deletions

View File

@@ -62,4 +62,24 @@ class CommonGrid {
};
}
public static function checkbox($type) {
return function($model) use ($type) {
if ($model->id == 1)
return "";
return "<input type='checkbox' value='{$model->id}' name='checkbox-{$type}' class='checkbox-{$type}'>";
};
}
public static function rows($type) {
return function($model, $index, $widget, $grid) use ($type) {
return [
"onclick" => "common.form(this, '{$type}');",
"style" => "cursor: pointer;",
"data" => [
"href" => Url::to(["update", "id" => $model->id])
]
];
};
}
}