diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index e25c6537de..c87cc91630 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -240,7 +240,7 @@ class addressbook_ui extends addressbook_bo 'business_adr_one_countrycode_adr_one_postalcode,tel_work_tel_cell_tel_home,url_email_email_home', /* old negative list 'default_cols' => '!cat_id,contact_created_contact_modified,distribution_list,contact_id,owner,room',*/ - 'filter2_onchange' => "app.addressbook.filter2_onchange();", + 'filter2_onchange' => "return app.addressbook.filter2_onchange();", 'manual' => $do_email ? ' ' : false, // space for the manual icon //'actions' => $this->get_actions(), // set on each request, as it depends on some filters 'row_id' => 'id', diff --git a/addressbook/js/app.js b/addressbook/js/app.js index f24b3dbc48..ae6c3eb827 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -666,16 +666,24 @@ app.classes.addressbook = AppJS.extend( var widget = this.et2.getWidgetById('nm'); var filter2_val = filter2.get_value(); - // automatic switch to accounts addressbook or all addressbooks depending on distribution list is a group - if (filter2_val && (filter2_val < 0) !== (filter.get_value() === '0')) - { - filter.set_value(filter2_val < 0 ? '0' : ''); - } if(filter2_val == 'add') { this.add_new_list(typeof widget == 'undefined' ? this.et2.getWidgetById('filter').value : widget.header.filter.get_value()); this.value=''; } + // automatic switch to accounts addressbook or all addressbooks depending on distribution list is a group + else if (filter2_val && (filter2_val < 0) !== (filter.get_value() === '0')) + { + // Change filter & filter2 at the same time + widget.applyFilters({ + filter: filter2_val < 0 ? '0' : '', + filter2: filter2_val + }); + // Don't get rows here, let applyFilters() do it + return false; + } + + return true; }, /**