Comments (6)
@MikeSandford did you try trigger change
event?
from django-location-field.
@caioariede thanks for taking a look at this! I just tried change
, keyup
, focusout
and blur
.
$("#id_location").val(loc_string).change().focusout().blur().keyup();
I also tried manually inputting 0,0
and when I clicked away from the input the map and marker didn't update that way either. It seems as though there's a binding from the "watched" form inputs to the map, but not from the actual lat/lon input to the map.
from django-location-field.
@caioariede I was able to put together some code that does the latlong input field to map marker binding and it works on my local machine. But then I went down the rabbit hole a little bit looking at leaflet docs and it seems like there's stuff in leaflet to do exactly that! map.locate
is available and you can even pass in a watch=true
parameter.
I can make a PR with what I already have but I'm not entirely sure what's the best route forward here. Are you interested in adding this capability? If so do you have a preference on how it's achieved? The one difficulty I have on attempting to expose the leaflet functionality is that I'm not sure how to get a reference to the map from the context of a webpage that has a button on it that a user presses to center the map on themselves. I can find the jQuery node that's the div of the map widget or the inner div of the actual rendered map but I haven't figured out how to get something that I can then call any of the $.locationField
methods on.
from django-location-field.
hello @MikeSandford please im havin gthe same issue , how do i fix it ,....
Thanks
from django-location-field.
+1
from django-location-field.
Solution would be to trigger a change on the city field or one of the other fields, "its" listening to.
Example if you have jQuery
after you have changed the value of location input field - then trigger a change on the city field
loc_string = ?something?
$("#id_location").val(loc_string);
$("#id_city").trigger('change');
or maybe you should trigger keyup on the city field - you'll have to look in the code to see or just play around with it.
I think that will do the trick for you :)
from django-location-field.
Related Issues (20)
- Map not rendering with Jet admin in one to many model
- map and longitude and latitude not adjusting in frontend HOT 1
- based_fields argument doesn't seem to work with ForeignKeys
- Showing different map types in admin and front end template
- Mixed content error with admin interface, osm, and https HOT 2
- Object of type CharField is not JSON serializable
- LocationField throws AttributeError because value is always None
- How to update map marker with current location on the map
- Can I hide the input (id_location) box but retain the others? HOT 5
- location field map not working with bootstrap 4 modal HOT 5
- Mapbox as a search provider?
- Mapbox doesn't work as map provider
- Fix initial map rendering
- Modernize CI/CD process
- Revamp documentation
- MissingFileError for `location_field/Leaflet.GoogleMutant.js.map` HOT 3
- Drop support for Python 2.7
- Access-Control-Allow-Origin Openstreetmap problem HOT 7
- Update Base Field after map marker is dragged to new location
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-location-field.