Editor’s Note: This post comes from Sugar Community Member Francesca Shiekh, who works for Sugar Professional Customer Wolfram Research. In this post, she shows how he solved the issue of building a subpanel filter.
We had a need to search within a subpanel without ever leaving the detail view we were on. In other words we wished to have a Subpanel Filter.
To achieve this I created a custom Widget that can be added to any standard subpanel and, by default, searches in the Name field of the corresponding table. Additionally I programmed in some exceptions to allow searching for the string in multiple fields for specific custom subpanels.
The result is a fill-in search form at the top of the subpanel:
When a search term is entered and the Filter is chosen the subpanel displays only matching records:
The “Clear” button will remove the filter and it will show all of the associated records.
- The Activities subpanel is not a standard subpanel, it is a combination of multiple modules, therefore the filter will need modifications to work there.
- The filter will break if Fancy Menus are chosen.
I would appreciate any suggestions for improvement: firstname.lastname@example.org
The steps to achieve this were as follows:
- Define a custom Widget
- Define the search entry point
- Add the filter “button” to the desired subpanel
First, define the custom Widget. In custom/include/generic/SugarWidgets define SugarWidgetSubPanelTopFilterInputButton.php
Second, define the search entry point. Notice some special treatment for some custom tables where we wanted to search in more than just the name field in custom/entry_points define filter_subpanel.php
And finally, add the filter “button” to the desired subpanel. For example, to add to the Opportunities Subpanel on the Account add file addTopFilter.php to the custom/Extension/modules/Accounts/Ext/Layoutdefs.