In Magento 2.2.5, I am creating admin grid by following this tutorial(Using layout Block method. Not UI Component).

In that I have a add button. I can't remove it. I need to remove it and add a new button with custom url. How to achieve this.



You can use update

$this->buttonList->update('save', 'onclick', 'setLocation(\'' . $this->getUrl('*/*/<youraction>') . '\')');

Try using this code


            '<your name>',
        'label' => __('<your label>'),
        'class' => 'save',
        'onclick' => 'setLocation(\'' . $this->getUrl('*/*/<youraction>') . '\')',
        'style' => '    background-color: #ba4000; border-color: #b84002; box-shadow: 0 0 0 1px #007bdb;color: #fff;text-decoration: none;'

Hope that will help you.

  • Yes, It is working. I have tried this but before parent::_construct(); i added this remove button code. So It is not worked. – Saravanan DS Oct 16 at 7:42

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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