Closed zhaoshl closed 3 years ago
$grid->rows(function (Grid\Row $row) {
if ($row->id = 10) {
$row->setAttributes(['style' => 'background: #ddd']);
}
});
$grid->rows(function (Grid\Row $row) { if ($row->id = 10) { $row->setAttributes(['style' => 'background: #ddd']); } });
非常感谢!
测试了一下,报错:
Argument 1 passed to App\Admin\Controllers\...Controller::App\Admin\Controllers\{closure}() must be an instance of Dcat\Admin\Grid\Row, instance of Illuminate\Support\Collection given, called in ...\vendor\dcat\laravel-admin\src\Grid.php on line 458
请教如何解决呢?
补充一下自己的解决办法,不知道是不是最佳的方案
$grid->rows(function (Collection $rows) {
$rows = $rows->each(function ($item, $key) {
if ($item->flag) {
$item->setAttributes(['style' => 'background: #ddd']);
}
});
});
补充一下自己的解决办法,不知道是不是最佳的方案
$grid->rows(function (Collection $rows) { $rows = $rows->each(function ($item, $key) { if ($item->flag) { $item->setAttributes(['style' => 'background: #ddd']); } }); });
是不是群主新版本改了
补充一下自己的解决办法,不知道是不是最佳的方案
$grid->rows(function (Collection $rows) { $rows = $rows->each(function ($item, $key) { if ($item->flag) { $item->setAttributes(['style' => 'background: #ddd']); } }); });
看了下源代码,这就是最佳的方案了,感谢
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Description:
使用行选择器 (rowSelector)的 设置选中行的背景颜色
$grid->rowSelector()->background(Admin::color()->dark20());
看不到效果$grid->rowSelector()->circle(false);//报错:Call to undefined method Dcat\Admin\Grid\Tools\RowSelector::circle()
请问有没有其他解决方案?
Steps To Reproduce: