Tangerine icon indicating copy to clipboard operation
Tangerine copied to clipboard

Filter by location on user profile no longer works

Open lachko opened this issue 2 years ago • 5 comments

The filter by location on user profile setting on the location input no longer works.

This input is supposed to filter out the entire list based on what is selected on the user profile as a location. Generally we have a higher level selected on the profile but it may be down to the bottom level.

lachko avatar Sep 19 '22 11:09 lachko

It looks like upon saving the user profile this variable is not set: window.tangyLocationFilterBy = 'locationId', if the location list is repeatable and multiple values can be set then the value is: window.tangyLocationFilterBy = 'locationId, locationId2' It should perhaps take this instead from the user profile: userService.profile.location

lachko avatar Oct 26 '23 08:10 lachko

It seems like the window property is not available but now filtering is possible through document.querySelector('tangy-location').filterBy = 'HO14HNOCOCAO' or generic: document.querySelector('tangy-location').filterBy = values(userService.profile.location).join() This filters based on what is set in the user profile

lachko avatar Nov 14 '23 14:11 lachko

The code in tangy-location input that applies the window.tangyLocationFilterBy is:

if (this.filterByGlobal) this.filterBy = window.tangyLocationFilterBy

The attribute filter-by-global needs to be set on the tangy-location input for the window property to work

For example:

<tangy-location name="center" required="" show-levels="District,Center" filter-by-global="" location-src="./assets/locations/cAMjboBj.json">
 </tangy-location>

esurface avatar Nov 14 '23 18:11 esurface

The code for this was added in 2018 and hasn't changed: https://github.com/Tangerine-Community/tangy-form/commit/4976c8f1b19f8f87c4bc90939770680b2213793d

It is working for me in the current release. @lachko please re-test and confirm.

esurface avatar Nov 29 '23 15:11 esurface

From Lachko:

image

esurface avatar Nov 29 '23 15:11 esurface