Menu
Welcome, Guest
Username: Password: Remember me

TOPIC: Add a custom action to the buttons on the right of a subpanel Row

Add a custom action to the buttons on the right of a subpanel Row 2 years 11 months ago #35871

  • rainolf
  • rainolf's Avatar
  • Offline
  • Elite Member
  • Posts: 173
  • Thank you received: 3
  • Karma: 1
Hello,
based on the following topic(many thank, really helpful):

suitecrm.com/forum/developer-help/8486-h...tton-to-any-subpanel

What about to add action to right buttons in subpanels(see addaction.png)?

In particular i need to add action which open a popupview to a relate field and it displays the updated record whithin subpanel.

Any help is really appreciate..

Thank you
Attachments:
Last Edit: 2 years 11 months ago by andy.
The administrator has disabled public write access.

Add action to right button 2 years 11 months ago #36200

  • andy
  • andy's Avatar
  • Offline
  • User is blocked
  • Software Engineer
  • Posts: 886
  • Thank you received: 167
  • Karma: 47
It can be done ;)

If you look at the layout defs of your subpanel you will see the definitions for the edit and remove buttons. I am looking at custom/modules/Contacts/metadata/subpanels/Account_subpanel_contacts.php

In there I can see :
 'edit_button' => 
  array (
    'vname' => 'LBL_EDIT_BUTTON',
    'widget_class' => 'SubPanelEditButton',
    'module' => 'Contacts',
    'width' => '5%',
    'default' => true,
  ),

'remove_button' => 
  array (
    'vname' => 'LBL_REMOVE',
    'widget_class' => 'SubPanelRemoveButton',
    'module' => 'Contacts',
    'width' => '5%',
    'default' => true,
  ),

notice that they both point to a widget_class
'widget_class' => 'SubPanelEditButton']
And
'widget_class' => 'SubPanelRemoveButton',

Widget classes are contained in : include/generic/SugarWidgets. But what you want to do is create your own widget class in custom/include/generic/SugarWidgets

If you inspect the actual edit button you will see a link similar to the following :

index.php?module=Contacts&action=EditView&record=6aa797c0-3b56-05b2-b2db-57ac8d113a4c&parent_module=Accounts&parent_id=cef2707e-3fd0-11e5-39d7-57557b10ceaf&return_module=Accounts&return_id=cef2707e-3fd0-11e5-39d7-57557b10ceaf&return_action=DetailView&return_relationship=contacts

What you need to do is create your definition in the subpanel layout defs that points to your own custom widget class that adds a link to your custom action in a similar manner to the above link.

Simple!!
Andrew Mclaughlan
Software Engineer

For SuiteCRM & SugarCRM CE coding tips go to : sugarmods.co.uk

Support the Project - Github Twitter Facebook
The administrator has disabled public write access.
The following user(s) said Thank You: fanton.ff

Add a custom action to the buttons on the right of a subpanel Row 2 years 11 months ago #36265

  • rainolf
  • rainolf's Avatar
  • Offline
  • Elite Member
  • Posts: 173
  • Thank you received: 3
  • Karma: 1
Thank you
i was almost in teh right direction...however something was not going as expected....

I will look better and i'll let you know..

Thanks again
The administrator has disabled public write access.

Add a custom action to the buttons on the right of a subpanel Row 2 years 10 months ago #38036

  • rainolf
  • rainolf's Avatar
  • Offline
  • Elite Member
  • Posts: 173
  • Thank you received: 3
  • Karma: 1
mmm..i've tried with no luck....
till now i was able to change only the button name....

What i need to do is to create a custom button called "Hook shipment" that can open a popup view and relate the field to my shipment module....once dne it should refresh and update me the field value visible in the subpanel list view...

Can you point me in the riegh direction?

Thank you
The administrator has disabled public write access.
Time to create page: 0.043 seconds
Powered by Kunena Forum