有SugarCRM developer blog article解释了如何修改某些核心文件,以便在没有要显示的数据时,在细节视图中折叠子面板。
能够添加此功能非常棒 - 特别是对于具有大量子面板的模块。但是,我们注意到,如果用户折叠子面板,当加载模块时该子面板中有数据时,子面板将保持折叠状态。
显然,这可能会有问题,因为用户很容易认为如果子面板被折叠,那么那里就没有信息,实际上存在信息。
我们想知道需要添加哪些代码来强制扩展具有数据的子面板。大概是在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");
}
在include / SubPanel / 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>
感谢任何人的帮助/建议!
答案 0 :(得分:0)
我之前遇到过这样的问题,我发现唯一简单的升级安全方法是使用jquery包含一个javascript文件,然后在前端操作DOM。另请参阅以下javascript方法:
showSubPanel