Filter in Subpanel suitecrm 7.10

Hi all.

There is the Widget SubPanelTopFilterButton which is used in history subpanel.

I tried this widget in other subpanels but it doesn’t work. I’ve tried in subpanel contacts in the accounts detailview.
No Filter is shown when I click on filter.

Should the widget work for other subpanels?
Has anyone soveld this problem in 7.10.x?

regards Robert

Got it working:

custom/modules//Ext/Layoutdefs/.php

$layout_defs["ModuleName"]["subpanel_setup"]['SubpanelName']['top_buttons'] =
  array (
    0 => 
    array (
      'widget_class' => 'SubPanelTopButtonQuickCreate',
    ),
    1 => 
    array (
      'widget_class' => 'SubPanelTopSelectButton',
      'mode' => 'MultiSelect',
    ), 
    2 => 
    array (
      'widget_class' => 'SubPanelTopFilterButton',
    ), 

  );

  $layout_defs["ModuleName"]["subpanel_setup"]['SubpanelName']['searchdefs'] =
array ( 'name' =>
        array (
            'name' => 'name',
            'default' => true,
            'width' => '10%',
        ),
        );

Thanks for sharing, this is interesting.

Does this survive a Quick Repair and Rebuild?

I am thinking this should be done in custom/Extension and the QR&R would generate the file in this directory you mention… not sure, though…

Sorry correct path is custom/Extension/modules//Ext/Layoutdefs/.php

Yes, that path is the correct way to make this upgrade-safe.

I tried this yesterday, for the Contacts’ subpanel in Accounts module, and I was able to get the “Filter” button to show, but it doesn’t do anything when I click it. Are you sure you didn’t do any additional change?

I’d like to get this operational and make a Technical Blog post in the Docs site with this, it can be useful for many people. Thanks.

don’ forget the layout … searchdefs part. This was my mistake

I didn’t forget it… but for some reason it is not taking effect. Maybe there is some small detail or difference between the module I am using and the one you’re using.

What is the exact code you’re using for your module? I can try making your exact example work first, and then figure out how to move it to a different module.

sorry I cannot post the code here. Editor is stripping of something
Attached is the file I used for Prospectlist subpannel in Accounts

Thanks!

The Forums have “code” tags you can use (look for that in the toolbar when writing a reply) to make code appear correctly, like this:


<?php

$layout_defs["Accounts"]["subpanel_setup"]["prospect_list_accounts"] = array (
		'order' => 10,
			'sort_by' => 'name',
			'sort_order' => 'asc',
			'module' => 'ProspectLists',
			'subpanel_name' => 'default',
			'get_subpanel_data' => 'prospect_list_accounts',
			'title_key' => 'LBL_PROSPECTLISTS_ACCOUNTS_FROM_PROSPECTLISTS_TITLE',
			'top_buttons' => array(
			    array('widget_class' => 'SubPanelTopButtonQuickCreate'),
				array('widget_class'=>'SubPanelTopSelectButton','mode'=>'MultiSelect'),
                array('widget_class'=>'SubPanelTopFilterButton'),
            ),
);
$layout_defs["Accounts"]["subpanel_setup"]["prospect_list_accounts"]['searchdefs'] =
    array ( 'name' =>
        array (
            'name' => 'name',
            'default' => true,
            'width' => '10%',
        ),
    );
?>

I’ll have a look at this and try to make it work when I have some time.

this works well for me - many thanks.

is it possible to apply a filter for the initial view?

Hi @pgr ,

it is not working for me for 7.11.10 version :(.

Please guide.

it’s not working for me 7.11.18

@SANTIAGO
It works for all version. What are you doing? Which file(s) do you edit? Which code do you writing?

Hi @p.konetskiy I trying to add a filter in cases subpanel in accounts module and the filter button appears but doesn’t do anything when I click it.

code:

<?php
$layout_defs["Accounts"]["subpanel_setup"]['cases'] = array (
		'order' => 10,
		'sort_by' => 'name',
		'sort_order' => 'asc',
		'module' => 'Cases',
		'subpanel_name' => 'default',
		'get_subpanel_data' => 'cases',
		'title_key' => 'LBL_CASES_SUBPANEL_TITLE',
		'top_buttons' => array(
			array('widget_class' => 'SubPanelTopButtonQuickCreate'),
			array('widget_class' => 'SubPanelTopSelectButton','mode'=>'MultiSelect'),
                	array('widget_class' => 'SubPanelTopFilterButton'),
		),
);
$layout_defs["Accounts"]["subpanel_setup"]['cases']['searchdefs'] = array ( 
	'name' => array (
            	'name' => 'name',
            	'default' => true,
            	'width' => '10%',
        ),
);

path:
custom/Extension/modules/Accounts/Ext/Layoutdefs/customCasesFilter.php

@SANTIAGO

You should use the relationship name the as the key for subpanel array and unset old array for system modules. The code:

<?php
unset($layout_defs["Accounts"]["subpanel_setup"]['cases']);
// key in "subpanel_setup" should be the name of relationship
$layout_defs["Accounts"]["subpanel_setup"]['account_cases'] = array (
		'order' => 10,
		'sort_by' => 'name',
		'sort_order' => 'asc',
		'module' => 'Cases',
		'subpanel_name' => 'default',
		'get_subpanel_data' => 'cases',
		'title_key' => 'LBL_CASES_SUBPANEL_TITLE',
		'top_buttons' => array(
			array('widget_class' => 'SubPanelTopButtonQuickCreate'),
			array('widget_class' => 'SubPanelTopSelectButton','mode'=>'MultiSelect'),
                	array('widget_class' => 'SubPanelTopFilterButton'),
		),
);
$layout_defs["Accounts"]["subpanel_setup"]['account_cases']['searchdefs'] = array ( 
	'name' => array (
            	'name' => 'name',
            	'default' => true,
            	'width' => '10%',
        ),
);
2 Likes

I had already used the name of relationship only missing unset the old array for the system modules. Thank you.

Hey guys, I have a custom module called Polizas wich is related to Accouns in one-to-many. The relationship name is seg_polizas_accounts.

I have created custom/Extension/modules/Accounts/Ext/Layoutdefs/customPolizasFilter.php

<?php
unset($layout_defs["Accounts"]["seg_polizas_accounts"]['polizas']);
// key in "subpanel_setup" should be the name of relationship
$layout_defs["Accounts"]["seg_polizas_accounts"]['Polizas'] = array (
	'order' => 10,
	'sort_by' => 'name',
	'sort_order' => 'asc',
	'module' => 'Polizas',
	'subpanel_name' => 'default',
	'get_subpanel_data' => 'Polizas',
	'title_key' => 'LBL_CASES_SUBPANEL_TITLE',
	'top_buttons' => array(
		array('widget_class' => 'SubPanelTopButtonQuickCreate'),
		array('widget_class' => 'SubPanelTopSelectButton','mode'=>'MultiSelect'),
            	array('widget_class' => 'SubPanelTopFilterButton'),
	),
);
$layout_defs["Accounts"]["seg_polizas_accounts"]['Polizas']['searchdefs'] = array ( 
'name' => array (
        	'name' => 'name',
        	'default' => true,
        	'width' => '10%',
    ),
);

Made a QRR but is not working.

Any idea to get it work?

Hi,
i think you should be using the relationship name for the subpanel. maybe this…

$layout_defs["Accounts"]["subpanel_setup"]['seg_polizas_accounts'] = array (
	'order' => 10,
	'sort_by' => 'name',
	'sort_order' => 'asc',
	'module' => 'Polizas',
	'subpanel_name' => 'default',
	'get_subpanel_data' => 'seg_polizas_accounts',
	'title_key' => 'LBL_CASES_SUBPANEL_TITLE',
	'top_buttons' => array(
		array('widget_class' => 'SubPanelTopButtonQuickCreate'),
		array('widget_class' => 'SubPanelTopSelectButton','mode'=>'MultiSelect'),
            	array('widget_class' => 'SubPanelTopFilterButton'),
	),
);
$layout_defs["Accounts"]["subpanel_setup"]['seg_polizas_accounts']['searchdefs'] = array ( 
'name' => array (
        	'name' => 'name',
        	'default' => true,
        	'width' => '10%',
    ),
);

Thanks for your reply @Bungle but is not showing the filter button.