Magento 2 Admin Grid Add/Update Button

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












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.



Screenshot:



Screenshot










share|improve this question



























    up vote
    2
    down vote

    favorite












    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.



    Screenshot:



    Screenshot










    share|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      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.



      Screenshot:



      Screenshot










      share|improve this question













      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.



      Screenshot:



      Screenshot







      admin grid magento-2.2.5 custom-button






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      Saravanan DS

      441520




      441520




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          5
          down vote













          You can use update



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





          share|improve this answer



























            up vote
            0
            down vote













            Try using this code



             parent::_construct();
            $this->removeButton('add');

            $this->buttonList->add(
            '<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.






            share|improve this answer




















            • 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
              1 hour ago











            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f246600%2fmagento-2-admin-grid-add-update-button%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            5
            down vote













            You can use update



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





            share|improve this answer
























              up vote
              5
              down vote













              You can use update



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





              share|improve this answer






















                up vote
                5
                down vote










                up vote
                5
                down vote









                You can use update



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





                share|improve this answer












                You can use update



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






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 1 hour ago









                Addify

                6395




                6395






















                    up vote
                    0
                    down vote













                    Try using this code



                     parent::_construct();
                    $this->removeButton('add');

                    $this->buttonList->add(
                    '<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.






                    share|improve this answer




















                    • 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
                      1 hour ago















                    up vote
                    0
                    down vote













                    Try using this code



                     parent::_construct();
                    $this->removeButton('add');

                    $this->buttonList->add(
                    '<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.






                    share|improve this answer




















                    • 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
                      1 hour ago













                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    Try using this code



                     parent::_construct();
                    $this->removeButton('add');

                    $this->buttonList->add(
                    '<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.






                    share|improve this answer












                    Try using this code



                     parent::_construct();
                    $this->removeButton('add');

                    $this->buttonList->add(
                    '<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.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 2 hours ago









                    Ashish Ranade

                    1626




                    1626











                    • 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
                      1 hour ago

















                    • 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
                      1 hour ago
















                    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
                    1 hour ago





                    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
                    1 hour ago


















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f246600%2fmagento-2-admin-grid-add-update-button%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    List of Gilmore Girls characters

                    Confectionery