Table of contents

Row

Row conditions

Allow Group Action

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;
});
1
2
3

Allow Inline Edit

Also inline editing cound be disabled for some rows:

$grid->allowRowsInlineEdit(function(Row $item): bool {
	return $item->role === 'admin';
});
1
2
3

Allow Actions

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;
});
1
2
3

Allow Action of MultiAction

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();
	}
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Row callback

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);
});
1
2
3

If you look at the example above, you will see that each row (<tr>) has class super-<id>.