Results 1 to 2 of 2

Thread: Forcing subpanels that DO have data to be expanded in DetailView

  1. #1
    MarkYork's Avatar
    MarkYork is offline Sugar Community Member
    Join Date
    Feb 2011
    Location
    Brooklyn Center, MN
    Posts
    67

    Question Forcing subpanels that DO have data to be expanded in DetailView

    There is a developer blog article that explains how to modify some core files so that subpanels are collapsed in the detailview when there is no data to display.

    It's great to be able to add this feature - especially for modules that have an extensive number of subpanels. However, we noticed that if a user collapses a subpanel, when a module is loaded that DOES have data in that subpanel, the subpanel stays collapsed.

    Obviously, this could potentially be problematic, as it would be easy for a user to assume that if a subpanel is collapsed, then there is no information there, when in fact there is.

    We're wondering what code would need to be added to force expanding subpanels that do have data. Presumably it would be a matter of adding an else clause in the ListView.php code.

    I've added the code from the blog below for your convenience.

    For anyone that hasn't read the blog and wishes to implement this, THIS IS NOT AN UPGRADE-SAFE SOLUTION!!

    In the Include/ListView/ListView.php file:
    PHP Code:
    if ( empty($data) ) {
            
    $this->xTemplate->assign("ROW_COLOR"'oddListRow');
            
    $thepanel=$subpanel_def;
            if(
    $subpanel_def->isCollection())
                
    $thepanel=$subpanel_def->get_header_panel_def();
            
    $this->xTemplate->assign("COL_COUNT"count($thepanel->get_list_fields()));

            
    // BEGIN CUSTOMIZATION
            
    $this->xTemplate->assign("PANEL_NAME"$thepanel->get_name());
            
    // END CUSTOMIZATION

            
    $this->xTemplate->parse($xtemplateSection.".nodata");
        } 
    And in the include/SubPanel/SubPanelDynamic.html file:
    HTML Code:
    <!-- BEGIN: nodata -->
    <tr height='20' class='{ROW_COLOR}S1'>
        <td colspan='{COL_COUNT}'>
            <em>{APP.LBL_NO_DATA}</em>
    
    <!-- BEGIN CUSTOMIZATION -->
    <script type="text/javascript">
    document.getElementById('subpanel_{PANEL_NAME}').style.display = 'none';
    document.getElementById('hide_link_{PANEL_NAME}').style.display = 'none';
    document.getElementById('show_link_{PANEL_NAME}').style.display = '';
    </script>
    <!-- END CUSTOMIZATION -->
    
        </td>
    </tr>
    <!-- END: nodata -->
    Thanks for anyone's help/suggestions!
    Web Applications Developer,
    US Internet Corp.

  2. #2
    MarkYork's Avatar
    MarkYork is offline Sugar Community Member
    Join Date
    Feb 2011
    Location
    Brooklyn Center, MN
    Posts
    67

    Default Re: Forcing subpanels that DO have data to be expanded in DetailView

    Hmm - it's been nearly two months since I originally posted this. I've not had any luck in getting the subpanels to be automatically expanded when they have data in them.

    Can anyone provide any suggestions on this?

    More importantly, can anyone provide an upgrade-safe solution to both automatically expanding and collapsing the subpanels based on whether or not there is anything to display in the subpanel?

    Thanks!
    Last edited by MarkYork; 2012-03-12 at 03:32 PM.
    Web Applications Developer,
    US Internet Corp.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dynamically Hide/Remove Subpanels in DetailView
    By robertbmirth in forum Developer Help
    Replies: 10
    Last Post: 2012-01-25, 05:13 PM
  2. HOW TO add/remove subpanels in detailview page
    By dekleinemedia in forum Help
    Replies: 8
    Last Post: 2009-07-02, 07:11 AM
  3. Detailview subpanels to retain pagination
    By stevec in forum Feature Requests
    Replies: 0
    Last Post: 2009-05-05, 09:11 AM
  4. how to add/remove subpanels in detailview page
    By prasannagowri in forum Help
    Replies: 3
    Last Post: 2009-04-10, 12:11 PM
  5. How to hide subpanels from the DetailView of Modules?
    By ingo.jaeckel in forum Developer Help
    Replies: 4
    Last Post: 2008-06-26, 11:52 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •