Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: n.latlng.split errors handling the geocode data when rendering map field #369

Closed
adam-jones-net opened this issue Sep 8, 2019 · 1 comment

Comments

@adam-jones-net
Copy link

adam-jones-net commented Sep 8, 2019

This may not be determined as being a bug - depending how one decides to code up handing a map field. However as very incomplete info is currently given on how to code up the map field in the official documentation and the method suggested here seems very simple and well executed, can I request that the file /vendor/area17/twill/frontend/js/components/LocationField.vue be altered as shown in this modification or at least made more robust to handle the data without producing these errors:

TypeError: n.latlng.split is not a function

To clarify, the view file /vendor/area17/twill/frontend/js/components/LocationField.vue is being changed from line 96 as follows....

set (value) {
          const coord = value.latlng.split('|')
          this.lat = parseFloat(coord[0])
          this.lng = parseFloat(coord[coord.length - 1])
          this.address = value.address
        }

to

set (value) {
          const coord = value.latlng.latlng.split('|')
          this.lat = parseFloat(coord[0])
          this.lng = parseFloat(coord[coord.length - 1])
          this.address = value.latlng.address
        }
@ifox
Copy link
Member

ifox commented Mar 5, 2020

Fixed in #371. Casting a single column to array is the simplest approach to use the map field.

@ifox ifox closed this as completed Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants