Results 1 to 3 of 3

Thread: Subpanel data not being refreshed

  1. #1
    rustinp77 is offline Sugar Community Member
    Join Date
    May 2007
    Location
    Mid-Atlantic, US
    Posts
    178

    Default Subpanel data not being refreshed

    Dear Sugarheads,

    I've recently developed several custom modules with Module Builder for basic functionality. These modules include various subpanels which properly build the relationships, however does not refresh the subpanel data to be displayed.

    I have searched up and down, tried to find a solution myself but, all I have came up with is to force a page refresh which is not what is wanted.

    Does anyone know of any secrets that could better resolve this issue before further time is spent on these issues.

    ~ Regards
    Rustin Phares
    OpenSales for SugarCRM
    Make a Donation
    sugarforge.org/projects/opensales

  2. #2
    killroy is offline Junior Member
    Join Date
    May 2007
    Posts
    3

    Default Re: Subpanel data not being refreshed

    I also had similar problems with the subpanel not refreshing. I resolved it but I'm not sure if it's the same problem. Here is some info on the subject:

    Subpanel refresh bug

    Some subpanels in modules have a select button with which a user can open popup, select a record from the popup and the record is immediately added to the list of the records in the subpanel. It was noticed that certain subpanels failed to immediately refresh data after the associated record was selected.

    An example definition of the subpanel for which the data wasn't refreshed, defined in custom/modules/Contacts/Ext/Layoutdefs/layoutdefs.ext.php

    PHP Code:
    'diff_users' => array(
                            
    'order' => 150,
                            
    'module' => 'Users',
                            
    'sort_order' => 'desc',
                             
    'sort_by' => 'user_name',
                            
    'get_subpanel_data'=>'diff_users',
                            
    'subpanel_name' => 'default',   
                            
    'title_key' => 'LBL_DIFF_USERS_SUBPANEL_TITLE',
                            
    'top_buttons' => array(
                                    array(
    'widget_class' => 'SubPanelTopSelectButton',
                                            
    'popup_module' => 'Users',
                                            
    'mode' => 'MultiSelect',                                        
                                    ),
                            ),
                    ), 
    SubPanelTopSelectButton is defined in /include/generic/SugarWidgets/SugarWidgetSubPanelTopSelectButton.php
    PHP Code:
    $popup_request_data = array(
                            
    'call_back_function' => 'set_return_and_save_background',
                            
    'form_name' => 'DetailView',
                            
    'field_to_name_array' => $fton_array,
                            
    'passthru_data' => array(
                                    
    'child_field' => $subpanel_name,
                                    
    'return_url' => urlencode($return_url),
                                    
    'link_field_name' => $link_field_name,
                                    
    'module_name' => $subpanel_name,        //this line is the problem
                                    
    'refresh_page'=>$refresh_page,
                            ),
                    ); 
    When Select is pressed on the subpanel form, this request data is forwarded to the popup window. When the record is selected, the popup window is closed, some of the requested data is forwarded to "http_fetch_sync" function in a form of URL which is located in set_return_and_save_background() function in /include/Subpanel/SubPanelTiles.js "http_fetch_sync" function returns a piece of html code which is then dynamically put into the associated subpanel.

    PHP Code:
    //include/Subpanel/SubPanelTiles.js 
    //function set_return_and_save_background(popup_reply_data)
    ...
    ...
            var 
    returnstuff http_fetch_sync('index.php',query_string);
            
    request_id++;
            
    got_data(returnstufftrue);
            if(
    refresh_page == 1){
                    
    document.location.reload(true);
            } 
    The problem is that 'module_name' in $popup_request_data in SugarWidgetSubPanelTopSelectButton.php is set to $subpanel_name which is just a regular module name (i.e. 'users'). Since the name of the panel in the example is 'diff_users', the returned html code is never put to the right place.

    ===Solution===

    The solution is to set 'module_name' to 'link_field_name' which is in our case 'diff_users'.

    SubPanelTopSelectButton is defined in /include/generic/SugarWidgets/SugarWidgetSubPanelTopSelectButton.php

    PHP Code:
    $popup_request_data = array(
                            
    'call_back_function' => 'set_return_and_save_background',
                            
    'form_name' => 'DetailView',
                            
    'field_to_name_array' => $fton_array,
                            
    'passthru_data' => array(
                                    
    'child_field' => $subpanel_name,
                                    
    'return_url' => urlencode($return_url),
                                    
    'link_field_name' => $link_field_name,
                                    
    //'module_name' => $subpanel_name,      //this line is the problem
                                    
    'module_name' => $link_field_name,      
                                    
    'refresh_page'=>$refresh_page,
                            ),
                    ); 

    I hope it helps.

  3. #3
    rustinp77 is offline Sugar Community Member
    Join Date
    May 2007
    Location
    Mid-Atlantic, US
    Posts
    178

    Default Re: Subpanel data not being refreshed

    I really do appreciate your efforts in helping me out however, no such luck of resolving any issue nor do I believe that is the nature of the problem.

    I'm going to try to resolve this issue at some point and will provide any solution I come across. I have just noticed most of my subpanels that were created with initially with Module Builder behave the same way however, I have recently found some new clues to help resolve this matter.

    Thanks again as he did led me to new areas unexplored...


    ~ Regards
    Rustin Phares
    OpenSales for SugarCRM
    Make a Donation
    sugarforge.org/projects/opensales

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sql data from another database under a subpanel.
    By andresol in forum Developer Help
    Replies: 10
    Last Post: 2011-12-07, 03:58 AM
  2. Subpanel working but showing All data
    By tritsma in forum Help
    Replies: 4
    Last Post: 2009-01-12, 05:43 AM
  3. Relationship data in subpanel
    By lvangool in forum Developer Help
    Replies: 18
    Last Post: 2009-01-12, 05:41 AM
  4. Replies: 9
    Last Post: 2007-06-12, 07:20 PM
  5. subpanel data in the editview??
    By sugarcare in forum Developer Help
    Replies: 12
    Last Post: 2006-08-30, 09:37 PM

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
  •