Tangerine
Tangerine copied to clipboard
Filter by location on user profile no longer works
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.
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
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
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>
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.
From Lachko: