Table of contents
Now all rows have to provide group action or editing. Or some other of your actions. You can forbid group acitons rendering for some items like this:
$grid->allowRowsGroupAction(function(Row $item): bool {
return $item->id !== 2;
});
Also inline editing cound be disabled for some rows:
$grid->allowRowsInlineEdit(function(Row $item): bool {
return $item->role === 'admin';
});
It works simalary when you want to allow actions for just some of your items:
$grid->allowRowsAction('delete', function(Row $item): bool {
return $item->id !== 3;
});
In case you need to show user just some actions in MultiAction list:
$grid->addMultiAction('goto', 'Go to')
->addAction('profile', 'Profile', 'Profile:default')
->addAction('settings', 'Settings', 'Settings:default')
->addAction('homepage', 'Homepage', 'Homepage:default');
$grid->allowRowsMultiAction(
'goto',
'profile',
function($item): bool {
return $item->canDispleyProfile();
}
);
$grid->allowRowsMultiAction(
'goto',
'settings',
function($item): bool {
return $item->canDispleySettings();
}
);
If you want to alter table row class, you can do this with row callback:
$grid->setRowCallback(function($item, $tr) {
$tr->addClass('super-' . $item->id);
});
If you look at the example above, you will see that each row (<tr>
) has class super-<id>
.