I want to hide link for edit/delete/view on grid based on certain condition.

How can I do that with ui component

1 Answer 1


enter image description here

I have done this using following way

In your grid listing file add below code

<actionsColumn name="actions" class="Vendor\Module\Ui\Component\Listing\Column\MerchantActions" sortOrder="10">

I have added a class to show actions

add below code to prepareDataSource function


public function prepareDataSource(array $dataSource)
    if (isset($dataSource['data']['items'])) {
        foreach ($dataSource['data']['items'] as &$item) {
            if (isset($item['log_id']) && empty($item['approval_status'])) {
                $item[$this->getData('name')] = ['edit' => ['href' => $this->urlBuilder->getUrl(static::URL_VIEW_PATH, ['log_id' => $item['log_id'],]), 'label' => __('View'),]];
    return $dataSource;

I have added condition based on approval_status field , you can add accordingly

if (isset($item['log_id']) && empty($item['approval_status'])) {

hope this will help you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.