Auto hide subpanels, when empty

Hi Iā€™ve tried to follow this link in order to have any empty subpanels be automatically hidden, however this is not working in SuiteCRM.

Iā€™m presuming the UI code has changed since 2011. I can see that the views are saved as cookies, and that a function hideSubPanel(<panel_id>) exists so I tried using that instead of modifying the panelā€™s display property directly, but still no effect.

Itā€™s as if any javascript inside a template has no effect, or the change is being overruled later in the javascript code.

Is there a solution which will work for SuiteCRM?

Iā€™ve since discovered the config option ā€˜hide_subpanels_on_loginā€™.

I would be happy with this, as long as I could show the number of records beside each subpanel title, however I think that this is determined at rendering time in the browser (AJAX calls), and so modifying the PHP isnā€™t going to help. Itā€™s also made harder by the fact the call is AJAX call for each subpanel is only made if a subpanel is open.

Would it be straightforward to look up the number of records for each subpanel? If so where should I look to add this call?

Check the following two posts, They do not achieve what you are looking to achieve but they contain useful information for your purpose:

http://cheleguanaco.blogspot.it/2012/04/sugarcrm-customization-dynamic.html

http://developer.sugarcrm.com/2013/02/27/add-custom-subpanel-in-accounts-module/

1 Like

Hi Iā€™ve seen the first post already - what it is doing is removing the panel entirely, I just want it collapsed by default. Unfortunately, Sugar devs chose ā€˜hideā€™ as the verb when they meant collapse.

Looking more at this problem, and thinking of improvements to the interface, what I really want to achieve is visual clues (numbers) beside subpanel title headers when there are records contained. To do this with the AJAX GUI would require some knowledge of the architecture which I donā€™t have right now.

Once the panels are drawn, we would lazy load each panelā€™s metrics (total num of records) and update the title dynamically in JS, without expanding the subpanel and retrieving the actual records. This call could then be run on a timer in the browser so that a visual clue for a ā€˜newā€™ item could be utilised, or a ā€˜contents has changedā€™ visual clue.

Like I say not that complicated, would really improve the interface and shouldnā€™t require a huge amount of changes. I just need some clues as to where to look.

Hey

Is there a a module somewhere to really ā€˜hideā€™ (or worst case ā€˜collapseā€™) subpanels that contain no data in the detail screens ? (and that 's upgrade safe, working on ondemand) ?

Right now Iā€™m using custom code to ā€˜unset panelsā€™. That 's only working for ā€˜acitivitiesā€™ and ā€˜historyā€™ since the rest contains relations. But donā€™t like this solution; there should be a better way (eg. Hiding subpanel if ā€˜no dataā€™).
I allready read some posts on different fora, but didnā€™t find a complete working solution. Closest was this one (but did not work for me).

did you get errors? or did the change in code not change the rendered page?

hi did you solve this?