有一個SugarCRM developer blog article解釋瞭如何修改某些核心文件,以便在沒有要顯示的數據時在詳細視圖中摺疊子面板。SugarCRM - 強制要將數據展開的子面板DetailView
很高興能夠添加此功能 - 特別是對於具有大量子面板的模塊。但是,我們注意到如果用戶摺疊一個子面板,當一個模塊被加載並且在該子面板中有數據時,子面板保持摺疊狀態。
顯然,這可能會有問題,因爲用戶很容易假設如果一個子面板被摺疊,那麼在那裏實際上沒有信息。
我們想知道需要添加哪些代碼才能強制擴展具有數據的子面板。推測這是一個在ListView.php代碼中添加else子句的問題。
爲了您的方便,我添加了下面博客的代碼。
對於任何沒有閱讀博客並希望實施此操作的人,這不是一個升級安全的解決方案!
在Include /的ListView/ListView.php文件:
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");
}
而且在包括/子面板/ SubPanelDynamic.html文件:
<!-- 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>
感謝任何人的幫助/建議!