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?