We wanted users to be able to search within the subpanel without leaving the page.
To achieve this I created a SugarWidget as follows:
The custom entry point filter_subpanel.php is a modified version of include/SubPanel/SubPanelViewer.php where the subpanel definition is manipulated to set the where clause.Code:<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); //error_reporting(E_ALL); //ini_set('display_errors', 'On'); require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php'); class SugarWidgetSubPanelTopFilterInputButton extends SugarWidgetSubpanelTopButton { function SugarWidgetSubPaneliFilterInputButton($button_properties=array()) { $this->button_properties=$button_properties; } function display(&$widget_data){ $subpanel_definition = $widget_data['subpanel_definition']; $subpanel_name = $subpanel_definition->get_name(); $module_name = ($_REQUEST['module']?$_REQUEST['module']:''); $id = ($_REQUEST['record']?$_REQUEST['record']:''); $prior_search_params[$subpanel_name] = trim($_REQUEST['search_params']?$_REQUEST['search_params']:''); if (isset($prior_search_params[$subpanel_name]) && $prior_search_params[$subpanel_name] != ''){ echo(" <i>Filter Applied:</i><b> " . $prior_search_params[$subpanel_name] . " </b> <small>(click Filter with no parameters to remove filter)</small>"); } $button = "<form><input type='text' id='filter_param_" . $subpanel_name . "' name='search_params' value='" . $prior_search_params[$subpanel_name] . "'>"; $button .= "<input type='submit' onclick=\"current_child_field = '" . $subpanel_name ."'; url='index.php?sugar_body_only=1&module=$module_name&subpanel=$subpanel_name&entryPoint=filter_subpanel&inline=1&record=$id&layout_def_key=$module_name&search_params=' + escape(document.getElementById('filter_param_' + current_child_field).value) ; showSubPanel('".$subpanel_name ."',url,true,'" . $module_name . "'); document.getElementById('show_link_" . $subpanel_name . "').style.display='none'; document.getElementById('hide_link_" . $subpanel_name . "').style.display=''; return false; \" href='#' value='Filter'></form>"; return $button; } } ?>


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks