Reverse The ListView Action Buttons

Interesting question asked on community forum, would love to share its solution!

Question : Can we do a reversal of ListView Action buttons ?

We have done the code for Accounts module. Change it as per your requirement.

Steps are as below,

1. Write the following code into custom/modules/Accounts/views/view.list.php

 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');   

  require_once('include/MVC/View/views/view.list.php');
  class AccountsViewList extends ViewList {
    public function preDisplay()
    {
      parent::preDisplay();
      require_once('custom/include/ListView/ListViewSmartyAccounts.php');
      $this->lv = new ListViewSmartyAccounts();
    }
  }

2.  Write the following code into custom/include/ListView/ListViewSmartyAccounts.php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');   

  require_once('include/ListView/ListViewSmarty.php');
  class ListViewSmartyAccounts extends ListViewSmarty {
    function buildActionsLink($id = 'actions_link', $location = 'top')
    {
      $link = parent::buildActionsLink();
      $link['buttons'] = array_reverse($link['buttons']);
      return $link;
    }
  }

3. Refresh the Accounts ListView page and see the effect.

Before Customization
After Customization

Hope you find this blog post helpful.

Feel free to add comments and queries, that helps us to improve the quality of posts.

You can contact us at info@techcrm.in

Thank you.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *