Skip to content

Commit c0126a6

Browse files
authored
Merge pull request #28 from nick-denry/master
Set order directly if model sortableAttribute value is null
2 parents a4a7ba5 + 622b30f commit c0126a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SortableGridBehavior.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function gridSort($items)
6262
$models = [];
6363
foreach ($items as $old => $new) {
6464
$models[$new] = $model::findOne($new);
65-
$newOrder[$old] = $models[$new]->{$this->sortableAttribute};
65+
$newOrder[$old] = $models[$new]->{$this->sortableAttribute} ? $models[$new]->{$this->sortableAttribute} : $new;
6666
}
6767
$model::getDb()->transaction(function () use ($models, $newOrder) {
6868
foreach ($newOrder as $modelId => $orderValue) {

0 commit comments

Comments
 (0)